diff --git a/CHANGELOG.md b/CHANGELOG.md index 3894c65..e189bbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ CHANGELOG ========= ## HEAD (Unreleased) +*(no changes)* + +## 1.1.1 (13.04.2014) * The Chromecast will no longer stay paused after seeking. (#10) * If casting is ended while playing, the browser seeks to the last position and plays. (#10) diff --git a/bower.json b/bower.json index a306839..205e5b9 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "videojs-chromecast", - "version": "1.1.0", + "version": "1.1.1", "homepage": "https://github.com/kim-company/videojs-chromecast", "author": { "name": "KIM Keep In Mind GmbH, srl", diff --git a/dist/videojs.chromecast.css b/dist/videojs.chromecast.css index 39789aa..30c0256 100644 --- a/dist/videojs.chromecast.css +++ b/dist/videojs.chromecast.css @@ -1,4 +1,4 @@ -/*! videojs-chromecast - v1.1.0 - 2015-02-21 +/*! videojs-chromecast - v1.1.1 - 2015-04-13 * https://github.com/kim-company/videojs-chromecast * Copyright (c) 2015 KIM Keep In Mind GmbH, srl; Licensed MIT */ diff --git a/dist/videojs.chromecast.js b/dist/videojs.chromecast.js index 2f7c5e1..3582bea 100644 --- a/dist/videojs.chromecast.js +++ b/dist/videojs.chromecast.js @@ -1,10 +1,10 @@ -/*! videojs-chromecast - v1.1.0 - 2015-02-21 +/*! videojs-chromecast - v1.1.1 - 2015-04-13 * https://github.com/kim-company/videojs-chromecast * Copyright (c) 2015 KIM Keep In Mind GmbH, srl; Licensed MIT */ (function() { - var __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; vjs.addLanguage("de", { "CASTING TO": "WIEDERGABE AUF" @@ -19,8 +19,8 @@ return this.controlBar.addChild(this.chromecastComponent); }); - vjs.ChromecastComponent = (function(_super) { - __extends(ChromecastComponent, _super); + vjs.ChromecastComponent = (function(superClass) { + extend(ChromecastComponent, superClass); ChromecastComponent.prototype.buttonText = "Chromecast"; @@ -46,8 +46,8 @@ ChromecastComponent.prototype.timerStep = 1000; - function ChromecastComponent(player, settings) { - this.settings = settings; + function ChromecastComponent(player, settings1) { + this.settings = settings1; ChromecastComponent.__super__.constructor.call(this, player, settings); if (!player.controls()) { this.disable(); @@ -101,16 +101,16 @@ }; ChromecastComponent.prototype.onSessionSuccess = function(session) { - var image, key, loadRequest, mediaInfo, value, _ref; + var image, key, loadRequest, mediaInfo, ref, value; vjs.log("Session initialized: " + session.sessionId); this.apiSession = session; this.addClass("connected"); mediaInfo = new chrome.cast.media.MediaInfo(this.player_.currentSrc(), this.player_.currentType()); if (this.settings.metadata) { mediaInfo.metadata = new chrome.cast.media.GenericMediaMetadata(); - _ref = this.settings.metadata; - for (key in _ref) { - value = _ref[key]; + ref = this.settings.metadata; + for (key in ref) { + value = ref[key]; mediaInfo.metadata[key] = value; } if (this.player_.options_.poster) { @@ -290,8 +290,8 @@ })(vjs.Button); - vjs.ChromecastTech = (function(_super) { - __extends(ChromecastTech, _super); + vjs.ChromecastTech = (function(superClass) { + extend(ChromecastTech, superClass); ChromecastTech.isSupported = function() { return this.player_.chromecastComponent.apiInitialized; @@ -314,7 +314,7 @@ ChromecastTech.prototype.createEl = function() { var element; element = document.createElement("div"); - element.id = "" + this.player_.id_ + "_chromecast_api"; + element.id = this.player_.id_ + "_chromecast_api"; element.className = "vjs-tech vjs-tech-chromecast"; element.innerHTML = "
\n
\n
\n
\n
" + (this.localize("CASTING TO")) + "
" + this.receiver + "
\n
\n
"; element.player = this.player_; diff --git a/dist/videojs.chromecast.min.css b/dist/videojs.chromecast.min.css index 006e408..0b77783 100644 --- a/dist/videojs.chromecast.min.css +++ b/dist/videojs.chromecast.min.css @@ -1,5 +1,5 @@ -/*! videojs-chromecast - v1.1.0 - 2015-02-21 +/*! videojs-chromecast - v1.1.1 - 2015-04-13 * https://github.com/kim-company/videojs-chromecast * Copyright (c) 2015 KIM Keep In Mind GmbH, srl; Licensed MIT */ -@font-face{font-family:chromecast;src:url("data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAS8AAsAAAAABHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgCCL8tmNtYXAAAAFoAAAATAAAAEwaVcxXZ2FzcAAAAbQAAAAIAAAACAAAABBnbHlmAAABvAAAAPwAAAD8H/uKE2hlYWQAAAK4AAAANgAAADYCPa1TaGhlYQAAAvAAAAAkAAAAJASAAoRobXR4AAADFAAAABQAAAAUA54AAGxvY2EAAAMoAAAADAAAAAwAKACSbWF4cAAAAzQAAAAgAAAAIAAKAD5uYW1lAAADVAAAAUUAAAFFVxmm7nBvc3QAAAScAAAAIAAAACAAAwAAAAMCAAGQAAUAAAFMAWYAAABHAUwBZgAAAPUAGQCEAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA5gAB4P/g/+AB4AAgAAAAAQAAAAAAAAAAAAAAIAAAAAAAAgAAAAMAAAAUAAMAAQAAABQABAA4AAAACgAIAAIAAgABACDmAP/9//8AAAAAACDmAP/9//8AAf/jGgQAAwABAAAAAAAAAAAAAAABAAH//wAPAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAQAAP/gAp4B4AAUAB0ALAA7AAATFR4BFx4BFzUhESEeARceARchESEDFTMuAScuASc1FR4BFx4BFzMuAScuASc1FR4BFx4BFzMuAScuAScnBw4GBw0GAg3+rwIFAgIDAQF3/YknSwMOCgoYDhYnDw8VBDUFHRYWOiEpSBwbJAU0BCwjI1s0AeDZAQMCAgUCs/6RBg0HBg4HAdn+S0sOGAoKDgNeNQQVDw8nFiE6FhYdBVw0BSQbHEgpNFsjIywEAAEAAAAAAAD1+MbOXw889QALAgAAAAAA0EC2SwAAAADQQLZLAAD/4AKeAeAAAAAIAAIAAAAAAAAAAQAAAeD/4AAAAp4AAAAAAp4AAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAABAAAAAp4AAAAAAAAACgAUAB4AfgABAAAABQA8AAQAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIADgBHAAEAAAAAAAMADgAkAAEAAAAAAAQADgBVAAEAAAAAAAUAFgAOAAEAAAAAAAYABwAyAAEAAAAAAAoANABjAAMAAQQJAAEADgAAAAMAAQQJAAIADgBHAAMAAQQJAAMADgAkAAMAAQQJAAQADgBVAAMAAQQJAAUAFgAOAAMAAQQJAAYADgA5AAMAAQQJAAoANABjAGkAYwBvAG0AbwBvAG4AVgBlAHIAcwBpAG8AbgAgADEALgAwAGkAYwBvAG0AbwBvAG5pY29tb29uAGkAYwBvAG0AbwBvAG4AUgBlAGcAdQBsAGEAcgBpAGMAbwBtAG8AbwBuAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") format("woff");font-weight:400;font-style:normal}.vjs-chromecast-button{float:right!important;cursor:pointer;width:3em!important}.vjs-chromecast-button:before{content:"\e600";font-family:chromecast!important}.vjs-chromecast-button.connected{color:#66A8CC}.vjs-tech-chromecast .casting-image{position:absolute;top:0;right:0;left:0;bottom:0;background-color:#000;background-repeat:no-repeat;background-size:contain;background-position:center}.vjs-tech-chromecast .casting-overlay{position:absolute;top:0;right:0;left:0;bottom:0;background-color:#000;opacity:.6;cursor:default}.vjs-tech-chromecast .casting-overlay .casting-information{position:absolute;left:15px;bottom:50px;right:15px;height:50px;color:#FFF}.vjs-tech-chromecast .casting-overlay .casting-information .casting-icon{font-family:chromecast!important;font-size:44px;line-height:50px;margin-right:10px;float:left;width:58px;height:50px}.vjs-tech-chromecast .casting-overlay .casting-information .casting-description{height:50px;font-size:20px;line-height:20px}.vjs-tech-chromecast .casting-overlay .casting-information .casting-description small{font-size:11px} \ No newline at end of file +@font-face{font-family:chromecast;src:url("data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAS8AAsAAAAABHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgCCL8tmNtYXAAAAFoAAAATAAAAEwaVcxXZ2FzcAAAAbQAAAAIAAAACAAAABBnbHlmAAABvAAAAPwAAAD8H/uKE2hlYWQAAAK4AAAANgAAADYCPa1TaGhlYQAAAvAAAAAkAAAAJASAAoRobXR4AAADFAAAABQAAAAUA54AAGxvY2EAAAMoAAAADAAAAAwAKACSbWF4cAAAAzQAAAAgAAAAIAAKAD5uYW1lAAADVAAAAUUAAAFFVxmm7nBvc3QAAAScAAAAIAAAACAAAwAAAAMCAAGQAAUAAAFMAWYAAABHAUwBZgAAAPUAGQCEAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA5gAB4P/g/+AB4AAgAAAAAQAAAAAAAAAAAAAAIAAAAAAAAgAAAAMAAAAUAAMAAQAAABQABAA4AAAACgAIAAIAAgABACDmAP/9//8AAAAAACDmAP/9//8AAf/jGgQAAwABAAAAAAAAAAAAAAABAAH//wAPAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAQAAP/gAp4B4AAUAB0ALAA7AAATFR4BFx4BFzUhESEeARceARchESEDFTMuAScuASc1FR4BFx4BFzMuAScuASc1FR4BFx4BFzMuAScuAScnBw4GBw0GAg3+rwIFAgIDAQF3/YknSwMOCgoYDhYnDw8VBDUFHRYWOiEpSBwbJAU0BCwjI1s0AeDZAQMCAgUCs/6RBg0HBg4HAdn+S0sOGAoKDgNeNQQVDw8nFiE6FhYdBVw0BSQbHEgpNFsjIywEAAEAAAAAAAD1+MbOXw889QALAgAAAAAA0EC2SwAAAADQQLZLAAD/4AKeAeAAAAAIAAIAAAAAAAAAAQAAAeD/4AAAAp4AAAAAAp4AAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAABAAAAAp4AAAAAAAAACgAUAB4AfgABAAAABQA8AAQAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIADgBHAAEAAAAAAAMADgAkAAEAAAAAAAQADgBVAAEAAAAAAAUAFgAOAAEAAAAAAAYABwAyAAEAAAAAAAoANABjAAMAAQQJAAEADgAAAAMAAQQJAAIADgBHAAMAAQQJAAMADgAkAAMAAQQJAAQADgBVAAMAAQQJAAUAFgAOAAMAAQQJAAYADgA5AAMAAQQJAAoANABjAGkAYwBvAG0AbwBvAG4AVgBlAHIAcwBpAG8AbgAgADEALgAwAGkAYwBvAG0AbwBvAG5pY29tb29uAGkAYwBvAG0AbwBvAG4AUgBlAGcAdQBsAGEAcgBpAGMAbwBtAG8AbwBuAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")format("woff");font-weight:400;font-style:normal}.vjs-chromecast-button{float:right!important;cursor:pointer;width:3em!important}.vjs-chromecast-button:before{content:"\e600";font-family:chromecast!important}.vjs-chromecast-button.connected{color:#66A8CC}.vjs-tech-chromecast .casting-image{position:absolute;top:0;right:0;left:0;bottom:0;background-color:#000;background-repeat:no-repeat;background-size:contain;background-position:center}.vjs-tech-chromecast .casting-overlay{position:absolute;top:0;right:0;left:0;bottom:0;background-color:#000;opacity:.6;cursor:default}.vjs-tech-chromecast .casting-overlay .casting-information{position:absolute;left:15px;bottom:50px;right:15px;height:50px;color:#FFF}.vjs-tech-chromecast .casting-overlay .casting-information .casting-icon{font-family:chromecast!important;font-size:44px;line-height:50px;margin-right:10px;float:left;width:58px;height:50px}.vjs-tech-chromecast .casting-overlay .casting-information .casting-description{height:50px;font-size:20px;line-height:20px}.vjs-tech-chromecast .casting-overlay .casting-information .casting-description small{font-size:11px} \ No newline at end of file diff --git a/dist/videojs.chromecast.min.js b/dist/videojs.chromecast.min.js index 9fb85f3..1a4c07b 100644 --- a/dist/videojs.chromecast.min.js +++ b/dist/videojs.chromecast.min.js @@ -1,5 +1,5 @@ -/*! videojs-chromecast - v1.1.0 - 2015-02-21 +/*! videojs-chromecast - v1.1.1 - 2015-04-13 * https://github.com/kim-company/videojs-chromecast * Copyright (c) 2015 KIM Keep In Mind GmbH, srl; Licensed MIT */ -(function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};vjs.addLanguage("de",{"CASTING TO":"WIEDERGABE AUF"}),vjs.addLanguage("it",{"CASTING TO":"PLAYBACK SU"}),vjs.plugin("chromecast",function(a){return this.chromecastComponent=new vjs.ChromecastComponent(this,a),this.controlBar.addChild(this.chromecastComponent)}),vjs.ChromecastComponent=function(a){function c(a,b){this.settings=b,c.__super__.constructor.call(this,a,b),a.controls()||this.disable(),this.hide(),this.initializeApi()}return b(c,a),c.prototype.buttonText="Chromecast",c.prototype.inactivityTimeout=2e3,c.prototype.apiInitialized=!1,c.prototype.apiSession=null,c.prototype.apiMedia=null,c.prototype.casting=!1,c.prototype.paused=!0,c.prototype.muted=!1,c.prototype.currentVolume=1,c.prototype.currentMediaTime=0,c.prototype.timer=null,c.prototype.timerStep=1e3,c.prototype.initializeApi=function(){var a,b,c;if(vjs.IS_CHROME)return chrome.cast&&chrome.cast.isAvailable?(b=this.settings.appId||chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,c=new chrome.cast.SessionRequest(b),a=new chrome.cast.ApiConfig(c,this.sessionJoinedListener,this.receiverListener.bind(this)),chrome.cast.initialize(a,this.onInitSuccess.bind(this),this.castError)):void setTimeout(this.initializeApi.bind(this),1e3)},c.prototype.sessionJoinedListener=function(){return void 0},c.prototype.receiverListener=function(a){return"available"===a?this.show():void 0},c.prototype.onInitSuccess=function(){return this.apiInitialized=!0},c.prototype.castError=function(a){return vjs.log("Cast Error: "+JSON.stringify(a))},c.prototype.doLaunch=function(){return this.apiInitialized?chrome.cast.requestSession(this.onSessionSuccess.bind(this),this.castError):vjs.log("Session not initialized")},c.prototype.onSessionSuccess=function(a){var b,c,d,e,f,g;if(this.apiSession=a,this.addClass("connected"),e=new chrome.cast.media.MediaInfo(this.player_.currentSrc(),this.player_.currentType()),this.settings.metadata){e.metadata=new chrome.cast.media.GenericMediaMetadata,g=this.settings.metadata;for(c in g)f=g[c],e.metadata[c]=f;this.player_.options_.poster&&(b=new chrome.cast.Image(this.player_.options_.poster),e.metadata.images=[b])}return d=new chrome.cast.media.LoadRequest(e),d.autoplay=!0,d.currentTime=this.player_.currentTime(),this.apiSession.loadMedia(d,this.onMediaDiscovered.bind(this),this.castError),this.apiSession.addUpdateListener(this.onSessionUpdate.bind(this))},c.prototype.onMediaDiscovered=function(a){return this.apiMedia=a,this.apiMedia.addUpdateListener(this.onMediaStatusUpdate.bind(this)),this.startProgressTimer(this.incrementMediaTime.bind(this)),this.player_.loadTech("ChromecastTech",{receiver:this.apiSession.receiver.friendlyName}),this.casting=!0,this.paused=this.player_.paused(),this.inactivityTimeout=this.player_.options_.inactivityTimeout,this.player_.options_.inactivityTimeout=0,this.player_.userActive(!0)},c.prototype.onSessionUpdate=function(a){return this.apiMedia?a?void 0:this.onStopAppSuccess():void 0},c.prototype.onMediaStatusUpdate=function(){if(this.apiMedia)switch(this.currentMediaTime=this.apiMedia.currentTime,this.apiMedia.playerState){case chrome.cast.media.PlayerState.IDLE:return this.currentMediaTime=0,this.trigger("timeupdate"),this.onStopAppSuccess();case chrome.cast.media.PlayerState.PAUSED:if(this.paused)return;return this.player_.pause(),this.paused=!0;case chrome.cast.media.PlayerState.PLAYING:if(!this.paused)return;return this.player_.play(),this.paused=!1}},c.prototype.startProgressTimer=function(a){return this.timer&&(clearInterval(this.timer),this.timer=null),this.timer=setInterval(a.bind(this),this.timerStep)},c.prototype.play=function(){return this.apiMedia&&this.paused?(this.apiMedia.play(null,this.mediaCommandSuccessCallback.bind(this,"Playing: "+this.apiMedia.sessionId),this.onError),this.paused=!1):void 0},c.prototype.pause=function(){return this.apiMedia?this.paused?void 0:(this.apiMedia.pause(null,this.mediaCommandSuccessCallback.bind(this,"Paused: "+this.apiMedia.sessionId),this.onError),this.paused=!0):void 0},c.prototype.seekMedia=function(a){var b;return b=new chrome.cast.media.SeekRequest,b.currentTime=a,this.player_.controlBar.progressControl.seekBar.videoWasPlaying&&(b.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START),this.apiMedia.seek(b,this.onSeekSuccess.bind(this,a),this.onError)},c.prototype.onSeekSuccess=function(a){return this.currentMediaTime=a},c.prototype.setMediaVolume=function(a,b){var c,d;if(this.apiMedia)return d=new chrome.cast.Volume,d.level=a,d.muted=b,this.currentVolume=d.level,this.muted=b,c=new chrome.cast.media.VolumeRequest,c.volume=d,this.apiMedia.setVolume(c,this.mediaCommandSuccessCallback.bind(this,"Volume changed"),this.onError),this.player_.trigger("volumechange")},c.prototype.incrementMediaTime=function(){return this.apiMedia.playerState===chrome.cast.media.PlayerState.PLAYING?this.currentMediaTime\n
\n
\n
\n
'+this.localize("CASTING TO")+"
"+this.receiver+"
\n
\n
",a.player=this.player_,vjs.insertFirst(a,this.player_.el()),a},c.prototype.play=function(){return this.player_.chromecastComponent.play(),this.player_.onPlay()},c.prototype.pause=function(){return this.player_.chromecastComponent.pause(),this.player_.onPause()},c.prototype.paused=function(){return this.player_.chromecastComponent.paused},c.prototype.currentTime=function(){return this.player_.chromecastComponent.currentMediaTime},c.prototype.setCurrentTime=function(a){return this.player_.chromecastComponent.seekMedia(a)},c.prototype.volume=function(){return this.player_.chromecastComponent.currentVolume},c.prototype.setVolume=function(a){return this.player_.chromecastComponent.setMediaVolume(a,!1)},c.prototype.muted=function(){return this.player_.chromecastComponent.muted},c.prototype.setMuted=function(a){return this.player_.chromecastComponent.setMediaVolume(this.player_.chromecastComponent.currentVolume,a)},c.prototype.supportsFullScreen=function(){return!1},c}(vjs.MediaTechController)}).call(this); \ No newline at end of file +(function(){var a=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a},b={}.hasOwnProperty;vjs.addLanguage("de",{"CASTING TO":"WIEDERGABE AUF"}),vjs.addLanguage("it",{"CASTING TO":"PLAYBACK SU"}),vjs.plugin("chromecast",function(a){return this.chromecastComponent=new vjs.ChromecastComponent(this,a),this.controlBar.addChild(this.chromecastComponent)}),vjs.ChromecastComponent=function(b){function c(a,b){this.settings=b,c.__super__.constructor.call(this,a,settings),a.controls()||this.disable(),this.hide(),this.initializeApi()}return a(c,b),c.prototype.buttonText="Chromecast",c.prototype.inactivityTimeout=2e3,c.prototype.apiInitialized=!1,c.prototype.apiSession=null,c.prototype.apiMedia=null,c.prototype.casting=!1,c.prototype.paused=!0,c.prototype.muted=!1,c.prototype.currentVolume=1,c.prototype.currentMediaTime=0,c.prototype.timer=null,c.prototype.timerStep=1e3,c.prototype.initializeApi=function(){var a,b,c;if(vjs.IS_CHROME)return chrome.cast&&chrome.cast.isAvailable?(b=this.settings.appId||chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,c=new chrome.cast.SessionRequest(b),a=new chrome.cast.ApiConfig(c,this.sessionJoinedListener,this.receiverListener.bind(this)),chrome.cast.initialize(a,this.onInitSuccess.bind(this),this.castError)):void setTimeout(this.initializeApi.bind(this),1e3)},c.prototype.sessionJoinedListener=function(a){return void 0},c.prototype.receiverListener=function(a){return"available"===a?this.show():void 0},c.prototype.onInitSuccess=function(){return this.apiInitialized=!0},c.prototype.castError=function(a){return vjs.log("Cast Error: "+JSON.stringify(a))},c.prototype.doLaunch=function(){return this.apiInitialized?chrome.cast.requestSession(this.onSessionSuccess.bind(this),this.castError):vjs.log("Session not initialized")},c.prototype.onSessionSuccess=function(a){var b,c,d,e,f,g;if(this.apiSession=a,this.addClass("connected"),e=new chrome.cast.media.MediaInfo(this.player_.currentSrc(),this.player_.currentType()),this.settings.metadata){e.metadata=new chrome.cast.media.GenericMediaMetadata,f=this.settings.metadata;for(c in f)g=f[c],e.metadata[c]=g;this.player_.options_.poster&&(b=new chrome.cast.Image(this.player_.options_.poster),e.metadata.images=[b])}return d=new chrome.cast.media.LoadRequest(e),d.autoplay=!0,d.currentTime=this.player_.currentTime(),this.apiSession.loadMedia(d,this.onMediaDiscovered.bind(this),this.castError),this.apiSession.addUpdateListener(this.onSessionUpdate.bind(this))},c.prototype.onMediaDiscovered=function(a){return this.apiMedia=a,this.apiMedia.addUpdateListener(this.onMediaStatusUpdate.bind(this)),this.startProgressTimer(this.incrementMediaTime.bind(this)),this.player_.loadTech("ChromecastTech",{receiver:this.apiSession.receiver.friendlyName}),this.casting=!0,this.paused=this.player_.paused(),this.inactivityTimeout=this.player_.options_.inactivityTimeout,this.player_.options_.inactivityTimeout=0,this.player_.userActive(!0)},c.prototype.onSessionUpdate=function(a){return this.apiMedia?a?void 0:this.onStopAppSuccess():void 0},c.prototype.onMediaStatusUpdate=function(a){if(this.apiMedia)switch(this.currentMediaTime=this.apiMedia.currentTime,this.apiMedia.playerState){case chrome.cast.media.PlayerState.IDLE:return this.currentMediaTime=0,this.trigger("timeupdate"),this.onStopAppSuccess();case chrome.cast.media.PlayerState.PAUSED:if(this.paused)return;return this.player_.pause(),this.paused=!0;case chrome.cast.media.PlayerState.PLAYING:if(!this.paused)return;return this.player_.play(),this.paused=!1}},c.prototype.startProgressTimer=function(a){return this.timer&&(clearInterval(this.timer),this.timer=null),this.timer=setInterval(a.bind(this),this.timerStep)},c.prototype.play=function(){return this.apiMedia&&this.paused?(this.apiMedia.play(null,this.mediaCommandSuccessCallback.bind(this,"Playing: "+this.apiMedia.sessionId),this.onError),this.paused=!1):void 0},c.prototype.pause=function(){return this.apiMedia?this.paused?void 0:(this.apiMedia.pause(null,this.mediaCommandSuccessCallback.bind(this,"Paused: "+this.apiMedia.sessionId),this.onError),this.paused=!0):void 0},c.prototype.seekMedia=function(a){var b;return b=new chrome.cast.media.SeekRequest,b.currentTime=a,this.player_.controlBar.progressControl.seekBar.videoWasPlaying&&(b.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START),this.apiMedia.seek(b,this.onSeekSuccess.bind(this,a),this.onError)},c.prototype.onSeekSuccess=function(a){return this.currentMediaTime=a},c.prototype.setMediaVolume=function(a,b){var c,d;if(this.apiMedia)return d=new chrome.cast.Volume,d.level=a,d.muted=b,this.currentVolume=d.level,this.muted=b,c=new chrome.cast.media.VolumeRequest,c.volume=d,this.apiMedia.setVolume(c,this.mediaCommandSuccessCallback.bind(this,"Volume changed"),this.onError),this.player_.trigger("volumechange")},c.prototype.incrementMediaTime=function(){return this.apiMedia.playerState===chrome.cast.media.PlayerState.PLAYING?this.currentMediaTime\n
\n
\n
\n
'+this.localize("CASTING TO")+"
"+this.receiver+"
\n
\n
",a.player=this.player_,vjs.insertFirst(a,this.player_.el()),a},c.prototype.play=function(){return this.player_.chromecastComponent.play(),this.player_.onPlay()},c.prototype.pause=function(){return this.player_.chromecastComponent.pause(),this.player_.onPause()},c.prototype.paused=function(){return this.player_.chromecastComponent.paused},c.prototype.currentTime=function(){return this.player_.chromecastComponent.currentMediaTime},c.prototype.setCurrentTime=function(a){return this.player_.chromecastComponent.seekMedia(a)},c.prototype.volume=function(){return this.player_.chromecastComponent.currentVolume},c.prototype.setVolume=function(a){return this.player_.chromecastComponent.setMediaVolume(a,!1)},c.prototype.muted=function(){return this.player_.chromecastComponent.muted},c.prototype.setMuted=function(a){return this.player_.chromecastComponent.setMediaVolume(this.player_.chromecastComponent.currentVolume,a)},c.prototype.supportsFullScreen=function(){return!1},c}(vjs.MediaTechController)}).call(this); \ No newline at end of file diff --git a/package.json b/package.json index 9b1a153..4fc41fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-chromecast", - "version": "1.1.0", + "version": "1.1.1", "homepage": "https://github.com/kim-company/videojs-chromecast", "author": { "name": "KIM Keep In Mind GmbH, srl", @@ -12,13 +12,13 @@ }, "dependencies": {}, "devDependencies": { - "express": "~ 4.10.1", + "express": "~ 4.12.3", "grunt": "~ 0.4.0", - "grunt-contrib-uglify": "~ 0.6.0", + "grunt-contrib-uglify": "~ 0.9.1", "grunt-contrib-clean": "~ 0.6.0", - "grunt-contrib-cssmin": "~ 0.10.0", - "grunt-contrib-coffee": "~ 0.12.0", - "grunt-contrib-less": "~ 0.12.0", - "grunt-banner": "~ 0.2.0" + "grunt-contrib-cssmin": "~ 0.12.2", + "grunt-contrib-coffee": "~ 0.13.0", + "grunt-contrib-less": "~ 1.0.1", + "grunt-banner": "~ 0.3.1" } }