dash-shaka-playback
Advanced tools
Comparing version 2.2.3 to 2.2.4
@@ -173,7 +173,13 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
function DashShakaPlayback(options) { | ||
function DashShakaPlayback() { | ||
var _ref; | ||
_classCallCheck(this, DashShakaPlayback); | ||
var _this = _possibleConstructorReturn(this, (DashShakaPlayback.__proto__ || Object.getPrototypeOf(DashShakaPlayback)).call(this, options)); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var _this = _possibleConstructorReturn(this, (_ref = DashShakaPlayback.__proto__ || Object.getPrototypeOf(DashShakaPlayback)).call.apply(_ref, [this].concat(args))); | ||
_this._levels = []; | ||
@@ -183,3 +189,3 @@ _this._pendingAdaptationEvent = false; | ||
options.autoPlay && _this.play(); | ||
_this.options.autoPlay && _this.play(); | ||
return _this; | ||
@@ -417,4 +423,18 @@ } | ||
_clappr.Log.error('Shaka error event:', error); | ||
this.trigger(_clappr.Events.PLAYBACK_ERROR, error, this.name); | ||
if (error.videoError) return _get(DashShakaPlayback.prototype.__proto__ || Object.getPrototypeOf(DashShakaPlayback.prototype), '_onError', this).call(this); | ||
var _ref2 = error.shakaError.detail || error.shakaError, | ||
category = _ref2.category, | ||
code = _ref2.code, | ||
severity = _ref2.severity; | ||
var errorData = { | ||
code: category + '_' + code, | ||
description: 'Category: ' + category + ', code: ' + code + ', severity: ' + severity, | ||
level: severity === 1 ? _clappr.PlayerError.Levels.WARN : _clappr.PlayerError.Levels.FATAL, | ||
raw: err | ||
}; | ||
var formattedError = this.createError(errorData); | ||
_clappr.Log.error('Shaka error event:', formattedError); | ||
this.trigger(_clappr.Events.PLAYBACK_ERROR, formattedError); | ||
} | ||
@@ -421,0 +441,0 @@ }, { |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("clappr"),require("shaka")):"function"==typeof define&&define.amd?define(["clappr","shaka"],e):"object"==typeof exports?exports.DashShakaPlayback=e(require("clappr"),require("shaka")):t.DashShakaPlayback=e(t.Clappr,t.shaka)}("undefined"!=typeof self?self:this,function(t,e){return function(t){function e(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="dist/",e(e.s=0)}([function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var o=function t(e,r,i){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,r);if(void 0===n){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,r,i)}if("value"in n)return n.value;var o=n.get;if(void 0!==o)return o.call(i)},s=function(){function t(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),u=r(1),l=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(l),h=function(t){function e(t){i(this,e);var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r._levels=[],r._pendingAdaptationEvent=!1,r._isShakaReadyState=!1,t.autoPlay&&r.play(),r}return a(e,t),s(e,[{key:"name",get:function(){return"dash_shaka_playback"}},{key:"shakaVersion",get:function(){return c.default.player.Player.version}},{key:"shakaPlayerInstance",get:function(){return this._player}},{key:"levels",get:function(){return this._levels}},{key:"currentLevel",set:function(t){var e=this;this._currentLevelId=t;var r=-1===this._currentLevelId;this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_START),r?(this._player.configure({abr:{enabled:!0}}),this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END)):(this._player.configure({abr:{enabled:!1}}),this._pendingAdaptationEvent=!0,this.selectTrack(this.videoTracks.filter(function(t){return t.id===e._currentLevelId})[0]))},get:function(){return this._currentLevelId||-1}}],[{key:"canPlay",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";c.default.polyfill.installAll();var r=c.default.Player.isBrowserSupported(),i=t.split("?")[0].match(/.*\.(.*)$/)||[];return r&&("mpd"===i[1]||e.indexOf("application/dash+xml")>-1)}},{key:"Events",get:function(){return{SHAKA_READY:"shaka:ready"}}}]),s(e,[{key:"play",value:function(){if(this._player||this._setup(),!this.isReady)return void this.once(e.Events.SHAKA_READY,this.play);this._stopped=!1,this._src=this.el.src,o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"play",this).call(this)}},{key:"setupSrc",value:function(){}},{key:"_ready",value:function(){}},{key:"_onShakaReady",value:function(){this._isShakaReadyState=!0,this.trigger(e.Events.SHAKA_READY),this.trigger(u.Events.PLAYBACK_READY,this.name)}},{key:"error",value:function(t){u.Log.error("an error was raised by the video tag",t,this.el.error)}},{key:"isHighDefinitionInUse",value:function(){return!!this.highDefinition}},{key:"stop",value:function(){var t=this;clearInterval(this.sendStatsId),this._stopped=!0,this._player?(this._sendStats(),this._player.unload().then(function(){o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",t).call(t),t._player=null,t._isShakaReadyState=!1}).catch(function(){u.Log.error("shaka could not be unloaded")})):o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this)}},{key:"getPlaybackType",value:function(){return(this.isReady&&this._player.isLive()?"live":"vod")||""}},{key:"selectTrack",value:function(t){if("text"===t.type)this._player.selectTextTrack(t);else{if("variant"!==t.type)throw new Error("Unhandled track type:",t.type);this._player.selectVariantTrack(t),t.mimeType.startsWith("video/")&&this._onAdaptation()}}},{key:"_enableShakaTextTrack",value:function(t){this.el.textTracks&&(this._shakaTTVisible=t,Array.from(this.el.textTracks).filter(function(t){return"subtitles"===t.kind}).forEach(function(e){return e.mode=!0===t?"showing":"hidden"}))}},{key:"_checkForClosedCaptions",value:function(){if(!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(u.Events.PLAYBACK_SUBTITLE_AVAILABLE);var t=this.closedCaptionsTrackId;this.closedCaptionsTrackId=t}this._ccIsSetup=!0}}},{key:"destroy",value:function(){var t=this;clearInterval(this.sendStatsId),this._player?this._player.destroy().then(function(){return t._destroy()}).catch(function(){t._destroy(),u.Log.error("shaka could not be destroyed")}):this._destroy(),o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this)}},{key:"_setup",value:function(){var t=this;this._isShakaReadyState=!1,this._ccIsSetup=!1,this._player=this._createPlayer(),this._options.shakaConfiguration&&this._player.configure(this._options.shakaConfiguration),this._options.shakaOnBeforeLoad&&this._options.shakaOnBeforeLoad(this._player),this._player.load(this._options.src).then(function(){return t._loaded()}).catch(function(e){return t._setupError(e)})}},{key:"_createPlayer",value:function(){var t=new c.default.Player(this.el);return t.addEventListener("error",this._onError.bind(this)),t.addEventListener("adaptation",this._onAdaptation.bind(this)),t.addEventListener("buffering",this._onBuffering.bind(this)),t}},{key:"_onBuffering",value:function(t){if(!this._stopped){var e=t.buffering?u.Events.PLAYBACK_BUFFERING:u.Events.PLAYBACK_BUFFERFULL;this.trigger(e)}}},{key:"_loaded",value:function(){this._onShakaReady(),this._startToSendStats(),this._fillLevels(),this._checkForClosedCaptions()}},{key:"_fillLevels",value:function(){0===this._levels.length&&(this._levels=this.videoTracks.map(function(t){return{id:t.id,label:t.height+"p"}}).reverse(),this.trigger(u.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels))}},{key:"_startToSendStats",value:function(){var t=this,e=this._options.shakaSendStatsInterval||3e4;this.sendStatsId=setInterval(function(){return t._sendStats()},e)}},{key:"_sendStats",value:function(){this.trigger(u.Events.PLAYBACK_STATS_ADD,this._player.getStats())}},{key:"_setupError",value:function(t){this._onError(t)}},{key:"_onError",value:function(t){var e={shakaError:t,videoError:this.el.error};u.Log.error("Shaka error event:",e),this.trigger(u.Events.PLAYBACK_ERROR,e,this.name)}},{key:"_onAdaptation",value:function(){var t=this.videoTracks.filter(function(t){return!0===t.active})[0];this._fillLevels(),this._sendStats(),this._pendingAdaptationEvent_&&(this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END),this._pendingAdaptationEvent=!1),u.Log.debug("an adaptation has happened:",t),this.highDefinition=t.height>=720,this.trigger(u.Events.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(u.Events.PLAYBACK_BITRATE,{bandwidth:t.bandwidth,width:t.width,height:t.height,level:t.id})}},{key:"_destroy",value:function(){this._isShakaReadyState=!1,u.Log.debug("shaka was destroyed")}},{key:"isReady",get:function(){return this._isShakaReadyState}},{key:"textTracks",get:function(){return this.isReady&&this._player.getTextTracks()}},{key:"audioTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("audio/")})}},{key:"videoTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("video/")})}},{key:"closedCaptionsTracks",get:function(){var t=0,e=function(){return t++};return(this.textTracks||[]).filter(function(t){return"subtitle"===t.kind}).map(function(t){return{id:e(),name:t.label||t.language,track:t}})}},{key:"closedCaptionsTrackId",get:function(){return o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"closedCaptionsTrackId",this)},set:function(t){if(this._player){var e=this.closedCaptionsTracks,r=void 0;if(-1!==t){if(!(r=e.find(function(e){return e.id===t})))return void u.Log.warn('Track id "'+t+'" not found');if(this._shakaTTVisible&&!0===r.track.active)return void u.Log.info('Track id "'+t+'" already showing')}r?(this._player.selectTextTrack(r.track),this._enableShakaTextTrack(!0)):this._enableShakaTextTrack(!1),this._ccTrackId=t,this.trigger(u.Events.PLAYBACK_SUBTITLE_CHANGED,{id:t})}}}]),e}(u.HTML5Video);e.default=h,t.exports=e.default},function(e,r){e.exports=t},function(t,r){t.exports=e}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("clappr"),require("shaka")):"function"==typeof define&&define.amd?define(["clappr","shaka"],e):"object"==typeof exports?exports.DashShakaPlayback=e(require("clappr"),require("shaka")):t.DashShakaPlayback=e(t.Clappr,t.shaka)}("undefined"!=typeof self?self:this,function(t,e){return function(t){function e(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="dist/",e(e.s=0)}([function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var o=function t(e,r,i){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,r);if(void 0===n){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,r,i)}if("value"in n)return n.value;var o=n.get;if(void 0!==o)return o.call(i)},s=function(){function t(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),l=r(1),u=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(u),h=function(t){function e(){var t;i(this,e);for(var r=arguments.length,a=Array(r),o=0;o<r;o++)a[o]=arguments[o];var s=n(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(a)));return s._levels=[],s._pendingAdaptationEvent=!1,s._isShakaReadyState=!1,s.options.autoPlay&&s.play(),s}return a(e,t),s(e,[{key:"name",get:function(){return"dash_shaka_playback"}},{key:"shakaVersion",get:function(){return c.default.player.Player.version}},{key:"shakaPlayerInstance",get:function(){return this._player}},{key:"levels",get:function(){return this._levels}},{key:"currentLevel",set:function(t){var e=this;this._currentLevelId=t;var r=-1===this._currentLevelId;this.trigger(l.Events.PLAYBACK_LEVEL_SWITCH_START),r?(this._player.configure({abr:{enabled:!0}}),this.trigger(l.Events.PLAYBACK_LEVEL_SWITCH_END)):(this._player.configure({abr:{enabled:!1}}),this._pendingAdaptationEvent=!0,this.selectTrack(this.videoTracks.filter(function(t){return t.id===e._currentLevelId})[0]))},get:function(){return this._currentLevelId||-1}}],[{key:"canPlay",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";c.default.polyfill.installAll();var r=c.default.Player.isBrowserSupported(),i=t.split("?")[0].match(/.*\.(.*)$/)||[];return r&&("mpd"===i[1]||e.indexOf("application/dash+xml")>-1)}},{key:"Events",get:function(){return{SHAKA_READY:"shaka:ready"}}}]),s(e,[{key:"play",value:function(){if(this._player||this._setup(),!this.isReady)return void this.once(e.Events.SHAKA_READY,this.play);this._stopped=!1,this._src=this.el.src,o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"play",this).call(this)}},{key:"setupSrc",value:function(){}},{key:"_ready",value:function(){}},{key:"_onShakaReady",value:function(){this._isShakaReadyState=!0,this.trigger(e.Events.SHAKA_READY),this.trigger(l.Events.PLAYBACK_READY,this.name)}},{key:"error",value:function(t){l.Log.error("an error was raised by the video tag",t,this.el.error)}},{key:"isHighDefinitionInUse",value:function(){return!!this.highDefinition}},{key:"stop",value:function(){var t=this;clearInterval(this.sendStatsId),this._stopped=!0,this._player?(this._sendStats(),this._player.unload().then(function(){o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",t).call(t),t._player=null,t._isShakaReadyState=!1}).catch(function(){l.Log.error("shaka could not be unloaded")})):o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this)}},{key:"getPlaybackType",value:function(){return(this.isReady&&this._player.isLive()?"live":"vod")||""}},{key:"selectTrack",value:function(t){if("text"===t.type)this._player.selectTextTrack(t);else{if("variant"!==t.type)throw new Error("Unhandled track type:",t.type);this._player.selectVariantTrack(t),t.mimeType.startsWith("video/")&&this._onAdaptation()}}},{key:"_enableShakaTextTrack",value:function(t){this.el.textTracks&&(this._shakaTTVisible=t,Array.from(this.el.textTracks).filter(function(t){return"subtitles"===t.kind}).forEach(function(e){return e.mode=!0===t?"showing":"hidden"}))}},{key:"_checkForClosedCaptions",value:function(){if(!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(l.Events.PLAYBACK_SUBTITLE_AVAILABLE);var t=this.closedCaptionsTrackId;this.closedCaptionsTrackId=t}this._ccIsSetup=!0}}},{key:"destroy",value:function(){var t=this;clearInterval(this.sendStatsId),this._player?this._player.destroy().then(function(){return t._destroy()}).catch(function(){t._destroy(),l.Log.error("shaka could not be destroyed")}):this._destroy(),o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this)}},{key:"_setup",value:function(){var t=this;this._isShakaReadyState=!1,this._ccIsSetup=!1,this._player=this._createPlayer(),this._options.shakaConfiguration&&this._player.configure(this._options.shakaConfiguration),this._options.shakaOnBeforeLoad&&this._options.shakaOnBeforeLoad(this._player),this._player.load(this._options.src).then(function(){return t._loaded()}).catch(function(e){return t._setupError(e)})}},{key:"_createPlayer",value:function(){var t=new c.default.Player(this.el);return t.addEventListener("error",this._onError.bind(this)),t.addEventListener("adaptation",this._onAdaptation.bind(this)),t.addEventListener("buffering",this._onBuffering.bind(this)),t}},{key:"_onBuffering",value:function(t){if(!this._stopped){var e=t.buffering?l.Events.PLAYBACK_BUFFERING:l.Events.PLAYBACK_BUFFERFULL;this.trigger(e)}}},{key:"_loaded",value:function(){this._onShakaReady(),this._startToSendStats(),this._fillLevels(),this._checkForClosedCaptions()}},{key:"_fillLevels",value:function(){0===this._levels.length&&(this._levels=this.videoTracks.map(function(t){return{id:t.id,label:t.height+"p"}}).reverse(),this.trigger(l.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels))}},{key:"_startToSendStats",value:function(){var t=this,e=this._options.shakaSendStatsInterval||3e4;this.sendStatsId=setInterval(function(){return t._sendStats()},e)}},{key:"_sendStats",value:function(){this.trigger(l.Events.PLAYBACK_STATS_ADD,this._player.getStats())}},{key:"_setupError",value:function(t){this._onError(t)}},{key:"_onError",value:function(t){var r={shakaError:t,videoError:this.el.error};if(r.videoError)return o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_onError",this).call(this);var i=r.shakaError.detail||r.shakaError,n=i.category,a=i.code,s=i.severity,u={code:n+"_"+a,description:"Category: "+n+", code: "+a+", severity: "+s,level:1===s?l.PlayerError.Levels.WARN:l.PlayerError.Levels.FATAL,raw:t},c=this.createError(u);l.Log.error("Shaka error event:",c),this.trigger(l.Events.PLAYBACK_ERROR,c)}},{key:"_onAdaptation",value:function(){var t=this.videoTracks.filter(function(t){return!0===t.active})[0];this._fillLevels(),this._sendStats(),this._pendingAdaptationEvent_&&(this.trigger(l.Events.PLAYBACK_LEVEL_SWITCH_END),this._pendingAdaptationEvent=!1),l.Log.debug("an adaptation has happened:",t),this.highDefinition=t.height>=720,this.trigger(l.Events.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(l.Events.PLAYBACK_BITRATE,{bandwidth:t.bandwidth,width:t.width,height:t.height,level:t.id})}},{key:"_destroy",value:function(){this._isShakaReadyState=!1,l.Log.debug("shaka was destroyed")}},{key:"isReady",get:function(){return this._isShakaReadyState}},{key:"textTracks",get:function(){return this.isReady&&this._player.getTextTracks()}},{key:"audioTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("audio/")})}},{key:"videoTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("video/")})}},{key:"closedCaptionsTracks",get:function(){var t=0,e=function(){return t++};return(this.textTracks||[]).filter(function(t){return"subtitle"===t.kind}).map(function(t){return{id:e(),name:t.label||t.language,track:t}})}},{key:"closedCaptionsTrackId",get:function(){return o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"closedCaptionsTrackId",this)},set:function(t){if(this._player){var e=this.closedCaptionsTracks,r=void 0;if(-1!==t){if(!(r=e.find(function(e){return e.id===t})))return void l.Log.warn('Track id "'+t+'" not found');if(this._shakaTTVisible&&!0===r.track.active)return void l.Log.info('Track id "'+t+'" already showing')}r?(this._player.selectTextTrack(r.track),this._enableShakaTextTrack(!0)):this._enableShakaTextTrack(!1),this._ccTrackId=t,this.trigger(l.Events.PLAYBACK_SUBTITLE_CHANGED,{id:t})}}}]),e}(l.HTML5Video);e.default=h,t.exports=e.default},function(e,r){e.exports=t},function(t,r){t.exports=e}])}); | ||
//# sourceMappingURL=dash-shaka-playback.external.min.js.map |
{ | ||
"name": "dash-shaka-playback", | ||
"version": "2.2.3", | ||
"version": "2.2.4", | ||
"description": "clappr dash playback based on shaka player", | ||
@@ -20,3 +20,3 @@ "main": "./dist/dash-shaka-playback.js", | ||
"peerDependencies": { | ||
"clappr": "^0.2.90" | ||
"clappr": "^0.2.91" | ||
}, | ||
@@ -23,0 +23,0 @@ "devDependencies": { |
@@ -1,2 +0,2 @@ | ||
import {HTML5Video, Log, Events} from 'clappr' | ||
import {HTML5Video, Log, Events, PlayerError} from 'clappr' | ||
import shaka from 'shaka-player' | ||
@@ -57,4 +57,4 @@ | ||
constructor (options) { | ||
super(options) | ||
constructor (...args) { | ||
super(...args) | ||
this._levels = [] | ||
@@ -64,3 +64,3 @@ this._pendingAdaptationEvent = false | ||
options.autoPlay && this.play() | ||
this.options.autoPlay && this.play() | ||
} | ||
@@ -288,3 +288,3 @@ | ||
_loaded () { | ||
this._onShakaReady(); | ||
this._onShakaReady() | ||
this._startToSendStats() | ||
@@ -321,4 +321,16 @@ this._fillLevels() | ||
Log.error('Shaka error event:', error) | ||
this.trigger(Events.PLAYBACK_ERROR, error, this.name) | ||
if (error.videoError) return super._onError() | ||
let { category, code, severity } = error.shakaError.detail || error.shakaError | ||
const errorData = { | ||
code: `${category}_${code}`, | ||
description: `Category: ${category}, code: ${code}, severity: ${severity}`, | ||
level: severity === 1 ? PlayerError.Levels.WARN : PlayerError.Levels.FATAL, | ||
raw: err | ||
} | ||
const formattedError = this.createError(errorData) | ||
Log.error('Shaka error event:', formattedError) | ||
this.trigger(Events.PLAYBACK_ERROR, formattedError) | ||
} | ||
@@ -325,0 +337,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1867032
3243