forked from snabb/webostv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mmediaviewer.go
36 lines (32 loc) · 882 Bytes
/
mmediaviewer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package webostv
func (tv *Tv) MediaViewerClose(sessionId string) (err error) {
_, err = tv.Request("ssap://media.viewer/close",
Payload{"sessionId": sessionId})
return err
}
func (tv *Tv) MediaViewerOpen(url, title, description, mimeType, iconSrc string, loop bool) (appId, sessionId string, err error) {
// {"returnValue":true,"id":"com.webos.app.tvsimpleviewer","sessionId":"Y29tLndlYm9zLmFwcC50dnNpbXBsZXZpZXdlcjp1bmRlZmluZWQ="}
p := make(Payload)
p["target"] = url
if title != "" {
p["title"] = title
}
if description != "" {
p["description"] = description
}
if mimeType != "" {
p["mimeType"] = mimeType
}
if iconSrc != "" {
p["iconSrc"] = iconSrc
}
if loop {
p["loop"] = loop
}
var resp struct {
Id string
SessionId string
}
err = tv.RequestResponseParam("ssap://media.viewer/open", p, &resp)
return resp.Id, resp.SessionId, err
}