Skip to content

Commit b2603f0

Browse files
author
Jeremy White
committed
Added play/pause support to bridge
1 parent ba80f43 commit b2603f0

File tree

4 files changed

+86
-2
lines changed

4 files changed

+86
-2
lines changed

dist/connect_bridge.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,42 @@ var connectsdk = (function () {
363363
});
364364
},
365365

366+
handlePlay: function (msgData) {
367+
var from = msgData.from;
368+
var mediaCommand = msgData.message.mediaCommand;
369+
var commandType = mediaCommand.type;
370+
var requestId = mediaCommand.requestId;
371+
372+
var mediaElement = this.mediaElement;
373+
mediaElement && mediaElement.play();
374+
375+
this.sendMessage(from, {
376+
contentType: 'connectsdk.mediaCommandResponse',
377+
mediaCommandResponse: {
378+
type: commandType,
379+
requestId: requestId
380+
}
381+
});
382+
},
383+
384+
handlePause: function (msgData) {
385+
var from = msgData.from;
386+
var mediaCommand = msgData.message.mediaCommand;
387+
var commandType = mediaCommand.type;
388+
var requestId = mediaCommand.requestId;
389+
390+
var mediaElement = this.mediaElement;
391+
mediaElement && mediaElement.pause();
392+
393+
this.sendMessage(from, {
394+
contentType: 'connectsdk.mediaCommandResponse',
395+
mediaCommandResponse: {
396+
type: commandType,
397+
requestId: requestId
398+
}
399+
});
400+
},
401+
366402
handleMessage: function (msgData) {
367403
var contentType = null;
368404

@@ -408,6 +444,12 @@ var connectsdk = (function () {
408444
case "seek":
409445
this.handleSeek(msgData);
410446
break;
447+
case "play":
448+
this.handlePlay(msgData);
449+
break;
450+
case "pause":
451+
this.handlePause(msgData);
452+
break;
411453
}
412454
},
413455

0 commit comments

Comments
 (0)