-
Notifications
You must be signed in to change notification settings - Fork 2
/
core.js
57 lines (46 loc) · 1.25 KB
/
core.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
var streamId="someStreamId2";
function emit(command, data) {
data.streamId = streamId;
socket.emit(command,data);
}
function sendPlay(time) {
console.log("sendPlay time:" + time);
handleSendPlay({"time": time});
emit("play", {"time": time})
}
function togglePlay() {
}
function sendPause(time) {
handleSendPause({"time": time});
emit("pause", {"time": time})
}
function sendRewind(time) {
console.log("sendRewind");
handleSendRewind({"time": time});
emit("rewind", {"time": time})
}
function sendForward(time) {
console.log("sendForward");
handleSendForward({"time": time});
emit("forward", {"time": time})
}
function sendShowOverlay() {
handleSendShowOverlay();
emit("showOverlay",{});
}
function sendHideOverlay() {
handleSendHideOverlay();
emit("hideOverlay",{});
}
function sendHref(href) {
emit("hrefInPlayer",{'href':href});
}
function connect() {
console.log("connecting to " + serverLocation + " using streamId " + streamId);
socket = io.connect(serverLocation);
socket.emit("join", {'streamId': streamId});
socket.on('onPlay', handleOnPlay);
socket.on('onPause', handleOnPause);
socket.on('onShowOverlay', handleOnShowOverlay);
socket.on('onHideOverlay', handleOnHideOverlay);
}