Skip to content

Instantly share code, notes, and snippets.

@MeoMix
Created July 21, 2015 01:31
Show Gist options
  • Save MeoMix/9f6957a75299e5134dbd to your computer and use it in GitHub Desktop.
Save MeoMix/9f6957a75299e5134dbd to your computer and use it in GitHub Desktop.
var MediaSourceWrapper = require('foreground/model/mediaSourceWrapper');
var VideoView = Marionette.ItemView.extend({
el: '#video',
mediaSourceWrapper: null,
mediaSourceWrapperEvents: {
'change:objectURL': '_onMediaSourceWrapperChangeObjectURL'
},
initialize: function() {
this.mediaSourceWrapper = new MediaSourceWrapper();
this.bindEntityEvents(this.mediaSourceWrapper, this.mediaSourceWrapperEvents);
},
_onMediaSourceWrapperChangeObjectURL: function(mediaSourceWrapper, objectURL) {
this._setVideoSrc(objectURL);
},
_setVideoSrc: function(objectURL) {
var videoSrc = objectURL === null ? '' : objectURL;
this.el.src = videoSrc;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment