-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathindex.js
116 lines (109 loc) · 2.97 KB
/
index.js
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Check URL Hash for Login with Webex Token
parseJwtFromURLHash();
const app = new window.Webex.Application();
app.onReady().then(() => {
log("onReady()", { message: "host app is ready" });
// Listen and emit any events from the EmbeddedAppSDK
app.listen().then(() => {
app.on("application:displayContextChanged", (payload) =>
log("application:displayContextChanged", payload)
);
app.on("application:shareStateChanged", (payload) =>
log("application:shareStateChanged", payload)
);
app.on("application:themeChanged", (payload) =>
log("application:themeChanged", payload)
);
app.on("meeting:infoChanged", (payload) =>
log("meeting:infoChanged", payload)
);
app.on("meeting:roleChanged", (payload) =>
log("meeting:roleChanged", payload)
);
app.on("space:infoChanged", (payload) => log("space:infoChanged", payload));
});
});
/**
* Sets the share url to the value entereed in the "shareUrl" element.
* @returns
*/
function handleSetShare() {
if (app.isShared) {
log("ERROR: setShareUrl() should not be called while session is active");
return;
}
var url = document.getElementById("shareUrl").value;
app
.setShareUrl(url, url, "Embedded App Kitchen Sink")
.then(() => {
log("setShareUrl()", {
message: "shared url to participants panel",
url: url,
});
})
.catch((error) => {
log(
"setShareUrl() failed with error",
Webex.Application.ErrorCodes[error]
);
});
}
/**
* Clears the share url
*/
function handleClearShare() {
app
.clearShareUrl()
.then(() => {
log("clearShareUrl()", { message: "share url has been cleared" });
})
.catch((error) => {
log(
"clearShareUrl() failed with error",
Webex.Application.ErrorCodes[error]
);
});
}
/**
* Sets the presentation URL
*/
async function handleSetPresentationUrl() {
if (app.isShared) {
log("ERROR: setShareUrl() should not be called while session is active");
return;
}
var url = document.getElementById("shareUrl").value;
let meeting = await app.context.getMeeting();
meeting.setPresentationUrl(url, "My Presentation", Webex.Application.ShareOptimizationMode.AUTO_DETECT, false)
.then(() => {
log("setPresentationUrl()", {
message: "presented url to participants panel",
url: url,
});
})
.catch((error) => {
log(
"setPresentationUrl() failed with error",
Webex.Application.ErrorCodes[error]
);
});
}
/**
* Clears the set presentation url
*/
async function handleClearPresentationUrl() {
let meeting = await app.context.getMeeting();
meeting.clearPresentationUrl()
.then(() => {
log("clearPresentationUrl()", {
message: "cleared url to participants panel",
url: url,
});
})
.catch((error) => {
log(
"clearPresentationUrl() failed with error",
Webex.Application.ErrorCodes[error]
);
});
}