@viewlift/player-backup 0.0.93 → 0.0.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";require("video.js/dist/video-js.min.css");var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/regenerator"),o=require("video.js"),i=require("./generic-81b1be69.js"),r=require("./util-ce8a4138.js"),l=require("./renditions-c3ea26e8.js"),s=require("./resolution-51b38a3e.js"),a=require("./skin-84083352.js");function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function d(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?u(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):u(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}require("axios"),require("js-cookie"),require("ua-parser-js"),require("@babel/runtime/helpers/toConsumableArray"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/assertThisInitialized"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/getPrototypeOf");var c,v,p=function(e,t){var n=i.getPlayer(e);n&&t&&n.controlBar&&n.controlBar.progressControl.seekBar.on("click",(function(t){var n,i,r,l,s,a=this.el(),u=o.dom.getPointerPosition(a,t).x;o.getPlayer(e).controlBar.durationDisplay.options_.playerOptions.disableRemotePlayback=!1;var d=window.cast&&window.cast.framework&&window.cast.framework.CastSession,c=null===(n=window)||void 0===n||null===(i=n.cast)||void 0===i||null===(r=i.framework)||void 0===r||null===(l=r.CastContext)||void 0===l||null===(s=l.getInstance())||void 0===s?void 0:s.S;if(console.log(d),d&&"CONNECTED"===c){window.cast.framework.RemotePlayer.canSeek=!0;var v=new window.cast.framework.RemotePlayerController(window.cast.framework.RemotePlayer),p=v.h.media[0].liveSeekableRange.end;v.getSeekPosition(),window.cast.framework.RemotePlayer.currentTime=p*u,v.seek()}}))};function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}var f=[],w=0,y=null;function h(e,n,o){var r,l,s,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];v=(null==n||null===(r=n.watchHistory)||void 0===r?void 0:r.apiVersion)||"v1";var u=null==n||null===(l=n.watchHistory)||void 0===l?void 0:l.profileId,d=Math.floor(e.currentTime()),p=Math.floor(e.duration()),f=null==n||null===(s=n.watchHistory)||void 0===s?void 0:s.xapiKey,h={};"v1"==v?h={videoId:c,watchedTime:Math.floor(e.currentTime()),watchedPercentage:Math.floor(d/p*100),siteOwner:n.siteOwner,userId:n.userId,xApiKey:f}:"v2"==v&&(h=function(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?m(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):m(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({videoId:c,watchedTime:Math.floor(e.currentTime()),watchedPercentage:a?100:Math.floor(d/p*100),doneWatching:a,profileId:u},y&&{seriesId:y})),i.saveWatchHistory(h,n.token,v).then((function(e){})).catch((function(e){})),w=d+o}var g=function(e,t,n){var o=i.getPlayer(e);if(o)if(t>=0&&t<=100){o.muted()&&o.muted(!1);var r=parseFloat(t)/100;o.volume(r),n&&n({status:!0,msg:"Volume set to ".concat(t,"%")})}else n&&n({status:!1,msg:"Please enter a valid volume percentage (0 ≥ V ≤ 100)"});else n({status:!1,msg:"Cannot find player with id: '".concat(e,"'")})},b=function(e){var t=i.getPlayer(e);return t?parseInt(100*t.volume())+"%":"Cannot find player with id: '".concat(e,"'")};function k(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}var O=function(e,n,o,r){var l,s,a=r.res,u=r.sres,d=i.getPlayer(e),v=(null==a||null===(l=a.video)||void 0===l||null===(s=l.streamingInfo)||void 0===s?void 0:s.isLiveStream)||!1;i.setCurrentVideo(a),d.on("loadstart",(function(){v&&o.resolve({status:!0,msg:"Video Loaded",response:a})})),d.on("loadeddata",(function(){var r;(null==d||!d.muted())&&g(e,sessionStorage.getItem("volume")||"100");var l,s,v=i.getCurrentVideo();(i.clearError(),o.resolve(function(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?k(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):k(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({status:!0,msg:"Player Initialised"},u?{seriesResponse:u,response:a}:{response:a})),null!=n&&n.watchHistory&&null!=n&&null!==(r=n.watchHistory)&&void 0!==r&&r.enable&&!n.isAnonymousUser)&&function(e,t,n){var o,r;null!=t&&t.series&&(y=null==t||null===(o=t.series)||void 0===o?void 0:o.id),f=[],w=0,c=n;var l=(null==t||null===(r=t.watchHistory)||void 0===r?void 0:r.interval)||30,s=i.getPlayer(e);s&&(s.on("timeupdate",(function(){var e=Math.floor(s.currentTime());f.includes(w)||(e==w?(f.push(e),h(s,t,l)):e>w&&(w=e+l))})),s.on("ended",(function(){h(s,t,l,!0)})))}(e,n,null==v||null===(l=v.video)||void 0===l||null===(s=l.gist)||void 0===s?void 0:s.id)})),d.textTracks().on("change",(function(e){var t=this.tracks_.filter((function(e){if("subtitles"===e.kind&&"showing"===e.mode)return!0}))[0];d.trigger("subtitlechanged",t)})),d.on("subtitlechanged",(function(e,t){var n,o,i,r,l,s,a,u,d,c,v=window.cast&&window.cast.framework&&window.cast.framework.CastSession,p=null===(n=window)||void 0===n||null===(o=n.cast)||void 0===o||null===(i=o.framework)||void 0===i||null===(r=i.CastContext)||void 0===r||null===(l=r.getInstance())||void 0===l?void 0:l.S,m=null===(s=window)||void 0===s||null===(a=s.cast)||void 0===a||null===(u=a.framework)||void 0===u||null===(d=u.CastContext)||void 0===d||null===(c=d.getInstance())||void 0===c?void 0:c.getCurrentSession();if(v&&"CONNECTED"===p){var f,w=m.getMediaSession(),y=w.media.tracks.filter((function(e){return"TEXT"==e.type}));f=t?new chrome.cast.media.EditTracksInfoRequest([y[0].trackId]):new chrome.cast.media.EditTracksInfoRequest([]),w.editTracksInfo(f)}})),d.on("loadedmetadata",(function(){})),d.one("error",(function(){var t,n;i.handleError(e,(null==d||null===(t=d.error())||void 0===t?void 0:t.message)||"Some error occured"),o.reject({status:!1,msg:(null==d||null===(n=d.error())||void 0===n?void 0:n.message)||"Some error occured"})})),d.one("play",(function(){var e;if(null!=n&&null!==(e=n.series)&&void 0!==e&&e.enable){var t,o,r,l=null===(t=i.getCurrentVideo())||void 0===t||null===(o=t.video)||void 0===o||null===(r=o.gist)||void 0===r?void 0:r.id,s=i.getSeriesWatchMap().get(l)||{t:0,p:0},a=s.t,u=s.p;a&&u<95&&setTimeout((function(){d.currentTime(a)}),0)}else null!=n&&n.watchHistoryResumeTime&&(null==n?void 0:n.watchedPercentage)<95&&d.currentTime(null==n?void 0:n.watchHistoryResumeTime)})),d.on("volumechange",(function(){var e=100*d.volume().toFixed(2);d.muted()?sessionStorage.setItem("volume",0):sessionStorage.setItem("volume",e)}))},P=function(e,t){var n=null==t?void 0:t.skin;"live"==n?Promise.resolve().then((function(){return require("./skin-9eba464b.js")})).then((function(n){n.initialiseSkin(e,t)})):"default"==n?Promise.resolve().then((function(){return require("./skin-b703ef26.js")})).then((function(n){n.initialiseSkin(e,t)})):"carousel"==n?Promise.resolve().then((function(){return require("./skin-534810ae.js")})).then((function(t){t.initaliseSkin(e)})):"defaultV2"==n?Promise.resolve().then((function(){return require("./skin-286f52db.js")})).then((function(n){n.initialiseSkin(e,t)})):"multiplayer"==n&&Promise.resolve().then((function(){return require("./skin-14da56f6.js")})).then((function(n){n.initialiseSkin(e,t)}))},j=function(e){return new Promise((function(t,n){if(I(e))n("".concat(e," is alread initialised"));else{var o=document.createElement("script");o.async=!1,o.src=e,document.head.appendChild(o),t()}}))},I=function(e){return document.querySelectorAll('script[src="'.concat(e,'"]')).length>0};function S(){var e,t;null===(e=window)||void 0===e||null===(t=e.dataLayer)||void 0===t||t.push(arguments)}var T=function(e,t){t.controlBar.el_.style.color=e,t.controlBar.el_.querySelector(".vjs-play-progress")&&(t.controlBar.el_.querySelector(".vjs-play-progress").style.backgroundColor=e),t.controlBar.el_.querySelector(".vjs-volume-level")&&(t.controlBar.el_.querySelector(".vjs-volume-level").style.backgroundColor=e)};var C,D=function(){var t=e(n.mark((function e(){return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,import("videojs-contrib-dash");case 2:case"end":return e.stop()}}),e)})));return function(){return t.apply(this,arguments)}}(),E=function(){var t=e(n.mark((function e(){return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,import("videojs-contrib-eme");case 2:case"end":return e.stop()}}),e)})));return function(){return t.apply(this,arguments)}}(),V=Object.freeze({__proto__:null,importChromecast:function(){import("@silvermine/videojs-chromecast").then((function(e){j("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1").then((function(){e.default(o)})).catch((function(e){console.log(e)}))}))},importAirplay:function(){import("@silvermine/videojs-airplay").then((function(e){e.default(o)}))},importIMA:function(){import("videojs-contrib-ads"),import("videojs-ima"),j("https://imasdk.googleapis.com/js/sdkloader/ima3.js").then((function(){})).catch((function(e){return console.log(e)}))},loadDashLibrary:D,loadEMELibrary:E});function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function x(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?q(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):q(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var R=function(r,l,s,a){var u,c,v,m,f,w,y,h,g,b,k,j,I,S,C,V,q,R,B,A,H,L,M,_=l.res,N=void 0===_?null:_,U=l.sres,W=void 0===U?null:U,z=(null===(u=window)||void 0===u||null===(c=u.cast)||void 0===c||null===(v=c.framework)||void 0===v||null===(m=v.CastContext)||void 0===m||null===(f=m.getInstance())||void 0===f?void 0:f.S)||void 0,F=null!=s&&s.chromecastReceiverId?"NO_DEVICES_AVAILABLE"!==z&&"NOT_CONNECTED"!==z?["html5","chromecast"]:["chromecast","html5"]:["html5"],J=null==N||null===(w=N.video)||void 0===w||null===(y=w.gist)||void 0===y?void 0:y.videoImageUrl,K=(null==N||null===(h=N.video)||void 0===h||null===(g=h.liveDetails)||void 0===g?void 0:g.isDvrEnabled)||!1,X=function(e){var t,n={};return null!=e&&e.series||null!=e&&e.chromecastReceiverId&&null!==(t=window)&&void 0!==t&&t.cast&&(n={chromecast:{receiverAppID:null==e?void 0:e.chromecastReceiverId,addButtonToControlBar:"default"==e.skin||"defaultV2"==e.skin,buttonPositionIndex:-5,addCastLabelToButton:!0}}),null!=e&&e.airplay&&"Safari"==i.detectBrowser()&&(n=d(d({},n),{},{airPlay:{addButtonToControlBar:"default"==e.skin,buttonPositionIndex:-6}})),n}(s),G=(null==N||null===(b=N.video)||void 0===b||null===(k=b.streamingInfo)||void 0===k?void 0:k.isLiveStream)||!1,Q=(null==s?void 0:s.drmLibrary)||!1,Y=(null==N||null===(j=N.ads)||void 0===j||null===(I=j.preRoll)||void 0===I||null===(S=I.adTags)||void 0===S||null===(C=S.web)||void 0===C?void 0:C.active)&&(null==N||null===(V=N.ads)||void 0===V||null===(q=V.preRoll)||void 0===q||null===(R=q.adTags)||void 0===R||null===(B=R.web)||void 0===B?void 0:B.url),Z=(M={controls:0!=(null==s?void 0:s.controls),playsinline:!0,fluid:!0,muted:(null==s?void 0:s.muted)||!1,autoplay:(null==s?void 0:s.autoplay)||!1,controlBar:{volumePanel:("default"==s.skin||"defaultV2"==s.skin||"live"==(null==s?void 0:s.skin))&&{inline:!1},fullscreenToggle:"default"==s.skin||"defaultV2"==s.skin,audioTrackButton:!1,pictureInPictureToggle:(s.skin,!1)},muteToggle:"multiplayer"==s.skin,liveui:K},t(M,"autoplay",null==s?void 0:s.autoplay),t(M,"normalizeAutoplay",(null==s?void 0:s.autoplay)&&!Y),t(M,"loop",(null==s?void 0:s.loop)||!1),t(M,"html5",x(x({vhs:x(x({experimentalLLHLS:(null==s?void 0:s.lowLatency)||!1,limitRenditionByPlayerDimensions:!0,useDevicePixelRatio:!0,useNetworkInformationApi:!0},(null==s||null===(A=s.customData)||void 0===A?void 0:A.overrideNative)&&{overrideNative:!0}),{},{enableLowInitialPlaylist:(null==s?void 0:s.enableLowInitialPlaylist)||!1})},0==(null==s||null===(H=s.customData)||void 0===H?void 0:H.nativeAudioTracks)&&{nativeAudioTracks:!1}),0==(null==s||null===(L=s.customData)||void 0===L?void 0:L.nativeVideoTracks)&&{nativeVideoTracks:!1})),t(M,"poster",J),t(M,"techOrder",F),t(M,"chromecast",{requestCustomDataFn:function(e){var t=i.getPlayer(r);console.log(t.textTracksJson_);var n=t.textTracksJson_.filter((function(e){return"subtitles"==e.kind}));return function(e,t,n){var o,i,r,l,s,a,u,d,c,v,p={};if(e&&e.video&&e.video.drmEnabled){p.isDrmEnabled=!0;var m=t.keySystemOptions&&t.keySystemOptions[0]&&t.keySystemOptions[0].options&&t.keySystemOptions[0].options.serverURL;p.licenseUrl=m;var f=t.keySystemOptions&&t.keySystemOptions[0]&&t.keySystemOptions[0].options&&t.keySystemOptions[0].options.httpRequestHeaders["X-AxDRM-Message"];p.licenseToken=f}var w=(null==e||null===(o=e.video)||void 0===o||null===(i=o.gist)||void 0===i?void 0:i.contentType)||"VIDEO";p.contentType=w;var y=null==e||null===(r=e.video)||void 0===r||null===(l=r.gist)||void 0===l?void 0:l.runtime;p.duration=y;var h=null==e||null===(s=e.video)||void 0===s||null===(a=s.gist)||void 0===a?void 0:a.title;p.mediaTitle=h;var g=null==e||null===(u=e.video)||void 0===u||null===(d=u.gist)||void 0===d?void 0:d.videoImageUrl;return p.mediaImage=g,p.subTitles=n,p.DVR=(null==e||null===(c=e.video)||void 0===c||null===(v=c.liveDetails)||void 0===v?void 0:v.isDvrEnabled)||!1,console.log(p),p}(N,e,n)}}),t(M,"plugins",X),M),$=o(r,Z,function(){var t=e(n.mark((function e(){var t,l,u,d,c,v,m,f,w,y,h,g,b,k,j,I,S;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(G&&a.resolve(x({status:!0,msg:"Player Initialised"},W?{seriesResponse:W,response:N}:{response:N})),"white"!==window.controlsColor&&T(window.controlsColor,$),/Android/i.test(navigator.userAgent)&&(o.options.vhs.overrideNative=!0),y=null==N||null===(t=N.video)||void 0===t?void 0:t.drmEnabled,h=null==N||null===(l=N.video)||void 0===l||null===(u=l.liveDetails)||void 0===u?void 0:u.startOverTime,!y&&!Q){e.next=13;break}if("Safari"!==i.detectBrowser()){e.next=11;break}return e.next=9,E();case 9:e.next=13;break;case 11:return e.next=13,Promise.all([E(),D()]);case 13:K&&p(r,h),!Y||null!=s&&null!==(d=s.customData)&&void 0!==d&&d.disableAds||i.initialiseAdvertisement(r,Y,N),g=i.getSource(N,r),(null==g?void 0:g.src).replace("us-e","a-m"),g?i.loadVideo(r,g):(a.reject({status:!1,msg:"Incompatible Source, only hls,mp4,drm content is allowed",response:N}),i.handleError(r,"Incompatible Source, only hls,mp4,drm content is allowed")),((null==N||null===(c=N.video)||void 0===c||null===(v=c.contentDetails)||void 0===v||null===(m=v.closedCaptions)||void 0===m?void 0:m.length)>0||(null==N||null===(f=N.video)||void 0===f||null===(w=f.closedCaptions)||void 0===w?void 0:w.length)>0)&&(S=(null==N||null===(k=N.video)||void 0===k||null===(j=k.contentDetails)||void 0===j?void 0:j.closedCaptions)||(null==N||null===(I=N.video)||void 0===I?void 0:I.closedCaptions),b=S.filter((function(e){return"VTT"===e.format})),i.addCaptions(r,b)),null!=s&&s.disableControls?i.disableControls(r):P(r,x(x(x({},s),Z),{},{liveVideo:G,isDvrEnabled:K,res:N,sres:W})),O(r,x(x(x({},s),Z),{},{liveVideo:G}),a,{res:N,sres:W});case 22:case"end":return e.stop()}}),e)})));return function(){return t.apply(this,arguments)}}())};module.exports=function(){return{loadVideoInstantly:i.loadVideoInstantly,onTimeUpdate:r.onTimeUpdate,getVideoDuration:r.getVideoDuration,onVideoEnded:r.onVideoEnded,init:function(e){return new Promise((function(t,n){var o,r,l,s,u,d,c,v,p;if(!i.isPlayerInitialised(null==e?void 0:e.playerId)){var m=null==e?void 0:e.videoId,f=(null==e||null===(o=e.series)||void 0===o?void 0:o.enable)||!1;window.videoId=m;var w=null==e?void 0:e.token;if(w&&!i.isTokenExpired(w)){C=JSON.parse(atob(w.split(".")[1])),window.siteId=null===(r=C)||void 0===r?void 0:r.siteId,window.siteName=null===(l=C)||void 0===l?void 0:l.site,e.isAnonymousUser=!(null===(s=C)||void 0===s||!s.anonymousId),e.siteOwner=(null===(u=C)||void 0===u?void 0:u.site)||null,e.userId=(null===(d=C)||void 0===d?void 0:d.userId)||null,window.sessionStorage.setItem("uid",null===(c=C)||void 0===c?void 0:c.userId),window.watchHistory=e.watchHistory||null,sessionStorage.setItem("token",w);var y=null==e?void 0:e.playerId,h=e.chromecastReceiverId=null!=e&&e.series?null:null==e?void 0:e.chromecastReceiverId,g=null==e?void 0:e.airplay,b=null==e?void 0:e.apiBaseUrl,k=(null==e||null===(v=e.analytics)||void 0===v?void 0:v.gaId)||null,O=null==e?void 0:e.errors;O&&(window.customErrors=O),window.customData=null==e?void 0:e.customData,b&&(window.playerEntitlementUrl=b),window.controlsColor=(null==e?void 0:e.controlsColor)||"white",null!=e&&e.skin&&!a.isNotAValidSkin(e.skin)||(e.skin="defaultV2"),Promise.resolve().then((function(){return V})).then((function(e){e.importIMA()})),!h||null!=e&&e.series||Promise.resolve().then((function(){return V})).then((function(e){e.importChromecast()})),g&&"Safari"==i.detectBrowser()&&Promise.resolve().then((function(){return V})).then((function(e){e.importAirplay()})),k&&j("https://www.googletagmanager.com/gtag/js?id=".concat(k)).then((function(){return e=k,window.dataLayer=window.dataLayer||[],S("js",new Date),void S("config",e);var e})).catch((function(e){}));var P=null===(p=document)||void 0===p?void 0:p.getElementById("".concat(y));if(P&&P.addEventListener("contextmenu",(function(e){return e.preventDefault()})),f){var I,T=null==e||null===(I=e.series)||void 0===I?void 0:I.id;i.getSeriesDetails(T,w).then((function(o){var r,l,s,a=o.data,u=o.data.seasons;i.setCurrentSeries(u);var d=m||(null==u||null===(r=u[0])||void 0===r||null===(l=r.episodes)||void 0===l||null===(s=l[0])||void 0===s?void 0:s.id);!function(e,t){var n=new Map;i.getSeriesWatchHistory({videoId:e,token:t}).then((function(e){e.data.map((function(e){n.set(e.videoId,{t:e.watchedTime,p:e.watchedPercentage})})),i.setSeriesWatchMap(n)})).catch((function(e){return console.log(e)}))}(T,w),i.getVideoDetails(d,w).then((function(o){var r,l,s;window.contentType=null==o||null===(r=o.data)||void 0===r||null===(l=r.video)||void 0===l||null===(s=l.gist)||void 0===s?void 0:s.contentType,i.setCurrentVideo(o.data),R(y,{res:null==o?void 0:o.data,sres:a},e,{resolve:t,reject:n})})).catch((function(e){i.initiateErrorHandling(e,y,n,m)}))})).catch((function(e){i.initiateErrorHandling(e,y,n)}))}else i.getVideoDetails(m,w).then((function(o){var r,l,s,a;window.contentType=null==o||null===(r=o.data)||void 0===r||null===(l=r.video)||void 0===l||null===(s=l.gist)||void 0===s?void 0:s.contentType,i.setCurrentVideo(null==o?void 0:o.data);var u=null==o?void 0:o.data;null!=e&&e.watchHistory&&null!=e&&null!==(a=e.watchHistory)&&void 0!==a&&a.enable?i.getVideoInfo(m,w).then((function(o){var i,r,l,s,a,d;null!==(i=window)&&void 0!==i&&null!==(r=i.watchHistory)&&void 0!==r&&r.cb&&(null===(l=window)||void 0===l||null===(s=l.watchHistory)||void 0===s||s.cb(null==o?void 0:o.data)),e.watchHistoryResumeTime=(null==o||null===(a=o.data)||void 0===a?void 0:a.watchedTime)||null,e.watchedPercentage=(null==o||null===(d=o.data)||void 0===d?void 0:d.watchedPercentage)||null,R(y,{res:u},e,{resolve:t,reject:n})})).catch((function(o){var i,r,l,s;null!==(i=window)&&void 0!==i&&null!==(r=i.watchHistory)&&void 0!==r&&r.cb&&(null===(l=window)||void 0===l||null===(s=l.watchHistory)||void 0===s||s.cb(o)),R(y,{res:u},e,{resolve:t,reject:n})})):R(y,{res:u},e,{resolve:t,reject:n})})).catch((function(e){i.initiateErrorHandling(e,y,n,m)}))}else n({status:!1,msg:"".concat(w?"Token is expired !":"Missing Authorization Token"),response:{token:w}})}}))},getRenditions:l.getRenditions,skip:i.skip,getPlayer:i.getPlayer,play:i.play,pause:i.pause,detectBrowser:i.detectBrowser,rewind:i.rewind,loadVideo:i.loadVideo,seekToTimeStamp:r.seekToTimeStamp,isPlayerInitialised:i.isPlayerInitialised,load:i.load,dispose:i.dispose,enableCaptions:i.enableCaptions,disableCaptions:i.disableCaptions,getCaptions:i.getCaptions,playSelectedResolution:s.playSelectedResolution,getSource:i.getSource,setVolume:g,getVolume:b,disableControls:i.disableControls,setPlaybackSpeed:r.setPlaybackSpeed}};
1
+ "use strict";require("video.js/dist/video-js.min.css");var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/regenerator"),o=require("video.js"),i=require("./generic-81b1be69.js"),r=require("./util-ce8a4138.js"),l=require("./renditions-c3ea26e8.js"),s=require("./resolution-51b38a3e.js"),a=require("./skin-84083352.js");function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function d(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?u(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):u(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}require("axios"),require("js-cookie"),require("ua-parser-js"),require("@babel/runtime/helpers/toConsumableArray"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/assertThisInitialized"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/getPrototypeOf");var c,v,p=function(e,t){var n=i.getPlayer(e);n&&t&&n.controlBar&&n.controlBar.progressControl.seekBar.on("click",(function(t){var n,i,r,l,s,a=this.el(),u=o.dom.getPointerPosition(a,t).x;o.getPlayer(e).controlBar.durationDisplay.options_.playerOptions.disableRemotePlayback=!1;var d=window.cast&&window.cast.framework&&window.cast.framework.CastSession,c=null===(n=window)||void 0===n||null===(i=n.cast)||void 0===i||null===(r=i.framework)||void 0===r||null===(l=r.CastContext)||void 0===l||null===(s=l.getInstance())||void 0===s?void 0:s.S;if(console.log(d),d&&"CONNECTED"===c){window.cast.framework.RemotePlayer.canSeek=!0;var v=new window.cast.framework.RemotePlayerController(window.cast.framework.RemotePlayer),p=v.h.media[0].liveSeekableRange.end;v.getSeekPosition(),window.cast.framework.RemotePlayer.currentTime=p*u,v.seek()}}))};function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}var f=[],w=0,y=null;function h(e,n,o){var r,l,s,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];v=(null==n||null===(r=n.watchHistory)||void 0===r?void 0:r.apiVersion)||"v1";var u=null==n||null===(l=n.watchHistory)||void 0===l?void 0:l.profileId,d=Math.floor(e.currentTime()),p=Math.floor(e.duration()),f=null==n||null===(s=n.watchHistory)||void 0===s?void 0:s.xapiKey,h={};"v1"==v?h={videoId:c,watchedTime:Math.floor(e.currentTime()),watchedPercentage:Math.floor(d/p*100),siteOwner:n.siteOwner,userId:n.userId,xApiKey:f}:"v2"==v&&(h=function(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?m(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):m(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({videoId:c,watchedTime:Math.floor(e.currentTime()),watchedPercentage:a?100:Math.floor(d/p*100),doneWatching:a,profileId:u},y&&{seriesId:y})),i.saveWatchHistory(h,n.token,v).then((function(e){})).catch((function(e){})),w=d+o}var g=function(e,t,n){var o=i.getPlayer(e);if(o)if(t>=0&&t<=100){o.muted()&&o.muted(!1);var r=parseFloat(t)/100;o.volume(r),n&&n({status:!0,msg:"Volume set to ".concat(t,"%")})}else n&&n({status:!1,msg:"Please enter a valid volume percentage (0 ≥ V ≤ 100)"});else n({status:!1,msg:"Cannot find player with id: '".concat(e,"'")})},b=function(e){var t=i.getPlayer(e);return t?parseInt(100*t.volume())+"%":"Cannot find player with id: '".concat(e,"'")};function k(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}var O=function(e,n,o,r){var l,s,a=r.res,u=r.sres,d=i.getPlayer(e),v=(null==a||null===(l=a.video)||void 0===l||null===(s=l.streamingInfo)||void 0===s?void 0:s.isLiveStream)||!1;i.setCurrentVideo(a),d.on("loadstart",(function(){v&&o.resolve({status:!0,msg:"Video Loaded",response:a})})),d.on("loadeddata",(function(){var r;(null==d||!d.muted())&&g(e,sessionStorage.getItem("volume")||"100");var l,s,v=i.getCurrentVideo();(i.clearError(),o.resolve(function(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?k(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):k(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({status:!0,msg:"Player Initialised"},u?{seriesResponse:u,response:a}:{response:a})),null!=n&&n.watchHistory&&null!=n&&null!==(r=n.watchHistory)&&void 0!==r&&r.enable&&!n.isAnonymousUser)&&function(e,t,n){var o,r;null!=t&&t.series&&(y=null==t||null===(o=t.series)||void 0===o?void 0:o.id),f=[],w=0,c=n;var l=(null==t||null===(r=t.watchHistory)||void 0===r?void 0:r.interval)||30,s=i.getPlayer(e);s&&(s.on("timeupdate",(function(){var e=Math.floor(s.currentTime());f.includes(w)||(e==w?(f.push(e),h(s,t,l)):e>w&&(w=e+l))})),s.on("ended",(function(){h(s,t,l,!0)})))}(e,n,null==v||null===(l=v.video)||void 0===l||null===(s=l.gist)||void 0===s?void 0:s.id)})),d.textTracks().on("change",(function(e){var t=this.tracks_.filter((function(e){if("subtitles"===e.kind&&"showing"===e.mode)return!0}))[0];d.trigger("subtitlechanged",t)})),d.on("subtitlechanged",(function(e,t){var n,o,i,r,l,s,a,u,d,c,v=window.cast&&window.cast.framework&&window.cast.framework.CastSession,p=null===(n=window)||void 0===n||null===(o=n.cast)||void 0===o||null===(i=o.framework)||void 0===i||null===(r=i.CastContext)||void 0===r||null===(l=r.getInstance())||void 0===l?void 0:l.S,m=null===(s=window)||void 0===s||null===(a=s.cast)||void 0===a||null===(u=a.framework)||void 0===u||null===(d=u.CastContext)||void 0===d||null===(c=d.getInstance())||void 0===c?void 0:c.getCurrentSession();if(v&&"CONNECTED"===p){var f,w=m.getMediaSession(),y=w.media.tracks.filter((function(e){return"TEXT"==e.type}));f=t?new chrome.cast.media.EditTracksInfoRequest([y[0].trackId]):new chrome.cast.media.EditTracksInfoRequest([]),w.editTracksInfo(f)}})),d.on("loadedmetadata",(function(){})),d.one("error",(function(){var t,n;i.handleError(e,(null==d||null===(t=d.error())||void 0===t?void 0:t.message)||"Some error occured"),o.reject({status:!1,msg:(null==d||null===(n=d.error())||void 0===n?void 0:n.message)||"Some error occured"})})),d.one("play",(function(){var e;if(null!=n&&null!==(e=n.series)&&void 0!==e&&e.enable){var t,o,r,l=null===(t=i.getCurrentVideo())||void 0===t||null===(o=t.video)||void 0===o||null===(r=o.gist)||void 0===r?void 0:r.id,s=i.getSeriesWatchMap().get(l)||{t:0,p:0},a=s.t,u=s.p;a&&u<95&&setTimeout((function(){d.currentTime(a)}),0)}else null!=n&&n.watchHistoryResumeTime&&(null==n?void 0:n.watchedPercentage)<95&&d.currentTime(null==n?void 0:n.watchHistoryResumeTime)})),d.on("volumechange",(function(){var e=100*d.volume().toFixed(2);d.muted()?sessionStorage.setItem("volume",0):sessionStorage.setItem("volume",e)}))},P=function(e,t){var n=null==t?void 0:t.skin;"live"==n?Promise.resolve().then((function(){return require("./skin-9eba464b.js")})).then((function(n){n.initialiseSkin(e,t)})):"default"==n?Promise.resolve().then((function(){return require("./skin-b703ef26.js")})).then((function(n){n.initialiseSkin(e,t)})):"carousel"==n?Promise.resolve().then((function(){return require("./skin-534810ae.js")})).then((function(t){t.initaliseSkin(e)})):"defaultV2"==n?Promise.resolve().then((function(){return require("./skin-286f52db.js")})).then((function(n){n.initialiseSkin(e,t)})):"multiplayer"==n&&Promise.resolve().then((function(){return require("./skin-14da56f6.js")})).then((function(n){n.initialiseSkin(e,t)}))},j=function(e){return new Promise((function(t,n){if(I(e))n("".concat(e," is alread initialised"));else{var o=document.createElement("script");o.async=!1,o.src=e,document.head.appendChild(o),t()}}))},I=function(e){return document.querySelectorAll('script[src="'.concat(e,'"]')).length>0};function S(){var e,t;null===(e=window)||void 0===e||null===(t=e.dataLayer)||void 0===t||t.push(arguments)}var C=function(e,t){t.controlBar.el_.style.color=e,t.controlBar.el_.querySelector(".vjs-play-progress")&&(t.controlBar.el_.querySelector(".vjs-play-progress").style.backgroundColor=e),t.controlBar.el_.querySelector(".vjs-volume-level")&&(t.controlBar.el_.querySelector(".vjs-volume-level").style.backgroundColor=e)};var T,D=function(){var t=e(n.mark((function e(){return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,import("videojs-contrib-dash");case 2:case"end":return e.stop()}}),e)})));return function(){return t.apply(this,arguments)}}(),E=function(){var t=e(n.mark((function e(){return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,import("videojs-contrib-eme");case 2:case"end":return e.stop()}}),e)})));return function(){return t.apply(this,arguments)}}(),V=Object.freeze({__proto__:null,importChromecast:function(){import("@silvermine/videojs-chromecast").then((function(e){j("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1").then((function(){e.default(o)})).catch((function(e){console.log(e)}))}))},importAirplay:function(){import("@silvermine/videojs-airplay").then((function(e){e.default(o)}))},importIMA:function(){import("videojs-contrib-ads"),import("videojs-ima"),j("https://imasdk.googleapis.com/js/sdkloader/ima3.js").then((function(){})).catch((function(e){return console.log(e)}))},loadDashLibrary:D,loadEMELibrary:E});function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function x(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?q(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):q(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var R=function(r,l,s,a){var u,c,v,m,f,w,y,h,g,b,k,j,I,S,T,V,q,R,B,A,H,L,M,_=l.res,N=void 0===_?null:_,U=l.sres,W=void 0===U?null:U,z=(null===(u=window)||void 0===u||null===(c=u.cast)||void 0===c||null===(v=c.framework)||void 0===v||null===(m=v.CastContext)||void 0===m||null===(f=m.getInstance())||void 0===f?void 0:f.S)||void 0,F=null!=s&&s.chromecastReceiverId?"NO_DEVICES_AVAILABLE"!==z&&"NOT_CONNECTED"!==z?["html5","chromecast"]:["chromecast","html5"]:["html5"],J=null==N||null===(w=N.video)||void 0===w||null===(y=w.gist)||void 0===y?void 0:y.videoImageUrl,K=(null==N||null===(h=N.video)||void 0===h||null===(g=h.liveDetails)||void 0===g?void 0:g.isDvrEnabled)||!1,X=function(e){var t,n={};return null!=e&&e.series||null!=e&&e.chromecastReceiverId&&null!==(t=window)&&void 0!==t&&t.cast&&(n={chromecast:{receiverAppID:null==e?void 0:e.chromecastReceiverId,addButtonToControlBar:"default"==e.skin||"defaultV2"==e.skin,buttonPositionIndex:-5,addCastLabelToButton:!0}}),null!=e&&e.airplay&&"Safari"==i.detectBrowser()&&(n=d(d({},n),{},{airPlay:{addButtonToControlBar:"default"==e.skin,buttonPositionIndex:-6}})),n}(s),G=(null==N||null===(b=N.video)||void 0===b||null===(k=b.streamingInfo)||void 0===k?void 0:k.isLiveStream)||!1,Q=(null==s?void 0:s.drmLibrary)||!1,Y=(null==N||null===(j=N.ads)||void 0===j||null===(I=j.preRoll)||void 0===I||null===(S=I.adTags)||void 0===S||null===(T=S.web)||void 0===T?void 0:T.active)&&(null==N||null===(V=N.ads)||void 0===V||null===(q=V.preRoll)||void 0===q||null===(R=q.adTags)||void 0===R||null===(B=R.web)||void 0===B?void 0:B.url),Z=(M={controls:0!=(null==s?void 0:s.controls),playsinline:!0,fluid:!0,muted:(null==s?void 0:s.muted)||!1,autoplay:(null==s?void 0:s.autoplay)||!1,controlBar:{volumePanel:("default"==s.skin||"defaultV2"==s.skin||"live"==(null==s?void 0:s.skin))&&{inline:!1},fullscreenToggle:"default"==s.skin||"defaultV2"==s.skin,audioTrackButton:!1,pictureInPictureToggle:(s.skin,!1)},muteToggle:"multiplayer"==s.skin,liveui:K},t(M,"autoplay",null==s?void 0:s.autoplay),t(M,"normalizeAutoplay",(null==s?void 0:s.autoplay)&&!Y),t(M,"loop",(null==s?void 0:s.loop)||!1),t(M,"html5",x(x({vhs:x(x({experimentalLLHLS:(null==s?void 0:s.lowLatency)||!1,limitRenditionByPlayerDimensions:!0,useDevicePixelRatio:!0,useNetworkInformationApi:!0},(null==s||null===(A=s.customData)||void 0===A?void 0:A.overrideNative)&&{overrideNative:!0}),{},{enableLowInitialPlaylist:(null==s?void 0:s.enableLowInitialPlaylist)||!1})},0==(null==s||null===(H=s.customData)||void 0===H?void 0:H.nativeAudioTracks)&&{nativeAudioTracks:!1}),0==(null==s||null===(L=s.customData)||void 0===L?void 0:L.nativeVideoTracks)&&{nativeVideoTracks:!1})),t(M,"poster",J),t(M,"techOrder",F),t(M,"chromecast",{requestCustomDataFn:function(e){var t=i.getPlayer(r);console.log(t.textTracksJson_);var n=t.textTracksJson_.filter((function(e){return"subtitles"==e.kind}));return function(e,t,n){var o,i,r,l,s,a,u,d,c,v,p={};if(e&&e.video&&e.video.drmEnabled){p.isDrmEnabled=!0;var m=t.keySystemOptions&&t.keySystemOptions[0]&&t.keySystemOptions[0].options&&t.keySystemOptions[0].options.serverURL;p.licenseUrl=m;var f=t.keySystemOptions&&t.keySystemOptions[0]&&t.keySystemOptions[0].options&&t.keySystemOptions[0].options.httpRequestHeaders["X-AxDRM-Message"];p.licenseToken=f}var w=(null==e||null===(o=e.video)||void 0===o||null===(i=o.gist)||void 0===i?void 0:i.contentType)||"VIDEO";p.contentType=w;var y=null==e||null===(r=e.video)||void 0===r||null===(l=r.gist)||void 0===l?void 0:l.runtime;p.duration=y;var h=null==e||null===(s=e.video)||void 0===s||null===(a=s.gist)||void 0===a?void 0:a.title;p.mediaTitle=h;var g=null==e||null===(u=e.video)||void 0===u||null===(d=u.gist)||void 0===d?void 0:d.videoImageUrl;return p.mediaImage=g,p.subTitles=n,p.DVR=(null==e||null===(c=e.video)||void 0===c||null===(v=c.liveDetails)||void 0===v?void 0:v.isDvrEnabled)||!1,console.log(p),p}(N,e,n)}}),t(M,"plugins",X),M),$=o(r,Z,function(){var t=e(n.mark((function e(){var t,l,u,d,c,v,m,f,w,y,h,g,b,k,j,I,S;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(G&&a.resolve(x({status:!0,msg:"Player Initialised"},W?{seriesResponse:W,response:N}:{response:N})),"white"!==window.controlsColor&&C(window.controlsColor,$),/Android/i.test(navigator.userAgent)&&(o.options.vhs.overrideNative=!0),y=null==N||null===(t=N.video)||void 0===t?void 0:t.drmEnabled,h=null==N||null===(l=N.video)||void 0===l||null===(u=l.liveDetails)||void 0===u?void 0:u.startOverTime,!y&&!Q){e.next=13;break}if("Safari"!==i.detectBrowser()){e.next=11;break}return e.next=9,E();case 9:e.next=13;break;case 11:return e.next=13,Promise.all([E(),D()]);case 13:K&&p(r,h),!Y||null!=s&&null!==(d=s.customData)&&void 0!==d&&d.disableAds||i.initialiseAdvertisement(r,Y,N),g=i.getSource(N,r),"IN"==s.countryCode&&(o.Vhs.xhr.beforeRequest=function(e){e.uri=e.uri.replace("us-e","a-m")}),g?i.loadVideo(r,g):(a.reject({status:!1,msg:"Incompatible Source, only hls,mp4,drm content is allowed",response:N}),i.handleError(r,"Incompatible Source, only hls,mp4,drm content is allowed")),((null==N||null===(c=N.video)||void 0===c||null===(v=c.contentDetails)||void 0===v||null===(m=v.closedCaptions)||void 0===m?void 0:m.length)>0||(null==N||null===(f=N.video)||void 0===f||null===(w=f.closedCaptions)||void 0===w?void 0:w.length)>0)&&(S=(null==N||null===(k=N.video)||void 0===k||null===(j=k.contentDetails)||void 0===j?void 0:j.closedCaptions)||(null==N||null===(I=N.video)||void 0===I?void 0:I.closedCaptions),b=S.filter((function(e){return"VTT"===e.format})),i.addCaptions(r,b)),null!=s&&s.disableControls?i.disableControls(r):P(r,x(x(x({},s),Z),{},{liveVideo:G,isDvrEnabled:K,res:N,sres:W})),O(r,x(x(x({},s),Z),{},{liveVideo:G}),a,{res:N,sres:W});case 21:case"end":return e.stop()}}),e)})));return function(){return t.apply(this,arguments)}}())};module.exports=function(){return{loadVideoInstantly:i.loadVideoInstantly,onTimeUpdate:r.onTimeUpdate,getVideoDuration:r.getVideoDuration,onVideoEnded:r.onVideoEnded,init:function(e){return new Promise((function(t,n){var o,r,l,s,u,d,c,v,p;if(!i.isPlayerInitialised(null==e?void 0:e.playerId)){var m=null==e?void 0:e.videoId,f=(null==e||null===(o=e.series)||void 0===o?void 0:o.enable)||!1;window.videoId=m;var w=null==e?void 0:e.token;if(w&&!i.isTokenExpired(w)){T=JSON.parse(atob(w.split(".")[1])),window.siteId=null===(r=T)||void 0===r?void 0:r.siteId,window.siteName=null===(l=T)||void 0===l?void 0:l.site,e.isAnonymousUser=!(null===(s=T)||void 0===s||!s.anonymousId),e.siteOwner=(null===(u=T)||void 0===u?void 0:u.site)||null,e.userId=(null===(d=T)||void 0===d?void 0:d.userId)||null,window.sessionStorage.setItem("uid",null===(c=T)||void 0===c?void 0:c.userId),window.watchHistory=e.watchHistory||null,sessionStorage.setItem("token",w);var y=null==e?void 0:e.playerId,h=e.chromecastReceiverId=null!=e&&e.series?null:null==e?void 0:e.chromecastReceiverId,g=null==e?void 0:e.airplay,b=null==e?void 0:e.apiBaseUrl,k=(null==e||null===(v=e.analytics)||void 0===v?void 0:v.gaId)||null,O=null==e?void 0:e.errors;O&&(window.customErrors=O),window.customData=null==e?void 0:e.customData,b&&(window.playerEntitlementUrl=b),window.controlsColor=(null==e?void 0:e.controlsColor)||"white",null!=e&&e.skin&&!a.isNotAValidSkin(e.skin)||(e.skin="defaultV2"),Promise.resolve().then((function(){return V})).then((function(e){e.importIMA()})),!h||null!=e&&e.series||Promise.resolve().then((function(){return V})).then((function(e){e.importChromecast()})),g&&"Safari"==i.detectBrowser()&&Promise.resolve().then((function(){return V})).then((function(e){e.importAirplay()})),k&&j("https://www.googletagmanager.com/gtag/js?id=".concat(k)).then((function(){return e=k,window.dataLayer=window.dataLayer||[],S("js",new Date),void S("config",e);var e})).catch((function(e){}));var P=null===(p=document)||void 0===p?void 0:p.getElementById("".concat(y));if(P&&P.addEventListener("contextmenu",(function(e){return e.preventDefault()})),f){var I,C=null==e||null===(I=e.series)||void 0===I?void 0:I.id;i.getSeriesDetails(C,w).then((function(o){var r,l,s,a=o.data,u=o.data.seasons;i.setCurrentSeries(u);var d=m||(null==u||null===(r=u[0])||void 0===r||null===(l=r.episodes)||void 0===l||null===(s=l[0])||void 0===s?void 0:s.id);!function(e,t){var n=new Map;i.getSeriesWatchHistory({videoId:e,token:t}).then((function(e){e.data.map((function(e){n.set(e.videoId,{t:e.watchedTime,p:e.watchedPercentage})})),i.setSeriesWatchMap(n)})).catch((function(e){return console.log(e)}))}(C,w),i.getVideoDetails(d,w).then((function(o){var r,l,s;window.contentType=null==o||null===(r=o.data)||void 0===r||null===(l=r.video)||void 0===l||null===(s=l.gist)||void 0===s?void 0:s.contentType,i.setCurrentVideo(o.data),R(y,{res:null==o?void 0:o.data,sres:a},e,{resolve:t,reject:n})})).catch((function(e){i.initiateErrorHandling(e,y,n,m)}))})).catch((function(e){i.initiateErrorHandling(e,y,n)}))}else i.getVideoDetails(m,w).then((function(o){var r,l,s,a;window.contentType=null==o||null===(r=o.data)||void 0===r||null===(l=r.video)||void 0===l||null===(s=l.gist)||void 0===s?void 0:s.contentType,i.setCurrentVideo(null==o?void 0:o.data);var u=null==o?void 0:o.data;null!=e&&e.watchHistory&&null!=e&&null!==(a=e.watchHistory)&&void 0!==a&&a.enable?i.getVideoInfo(m,w).then((function(o){var i,r,l,s,a,d;null!==(i=window)&&void 0!==i&&null!==(r=i.watchHistory)&&void 0!==r&&r.cb&&(null===(l=window)||void 0===l||null===(s=l.watchHistory)||void 0===s||s.cb(null==o?void 0:o.data)),e.watchHistoryResumeTime=(null==o||null===(a=o.data)||void 0===a?void 0:a.watchedTime)||null,e.watchedPercentage=(null==o||null===(d=o.data)||void 0===d?void 0:d.watchedPercentage)||null,R(y,{res:u},e,{resolve:t,reject:n})})).catch((function(o){var i,r,l,s;null!==(i=window)&&void 0!==i&&null!==(r=i.watchHistory)&&void 0!==r&&r.cb&&(null===(l=window)||void 0===l||null===(s=l.watchHistory)||void 0===s||s.cb(o)),R(y,{res:u},e,{resolve:t,reject:n})})):R(y,{res:u},e,{resolve:t,reject:n})})).catch((function(e){i.initiateErrorHandling(e,y,n,m)}))}else n({status:!1,msg:"".concat(w?"Token is expired !":"Missing Authorization Token"),response:{token:w}})}}))},getRenditions:l.getRenditions,skip:i.skip,getPlayer:i.getPlayer,play:i.play,pause:i.pause,detectBrowser:i.detectBrowser,rewind:i.rewind,loadVideo:i.loadVideo,seekToTimeStamp:r.seekToTimeStamp,isPlayerInitialised:i.isPlayerInitialised,load:i.load,dispose:i.dispose,enableCaptions:i.enableCaptions,disableCaptions:i.disableCaptions,getCaptions:i.getCaptions,playSelectedResolution:s.playSelectedResolution,getSource:i.getSource,setVolume:g,getVolume:b,disableControls:i.disableControls,setPlaybackSpeed:r.setPlaybackSpeed}};
package/esm/index.js CHANGED
@@ -1 +1 @@
1
- import"video.js/dist/video-js.min.css";import e from"@babel/runtime/helpers/asyncToGenerator";import o from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/regenerator";import n from"video.js";import{d as i,g as r,s as l,c as a,h as s,a as u,b as d,e as c,f as v,i as m,l as p,j as f,p as w,k as y,r as h,m as g,n as b,o as k,q as O,t as j,u as P,v as I,w as T,x as S,y as C,z as D,A as E,B as x,C as R,D as V,E as A,F as B}from"./generic-4a3c0d6b.js";import{o as L,g as H,a as _,s as M,b as N}from"./util-9c9ee6b3.js";import{g as q}from"./renditions-0fdb57ed.js";import{playSelectedResolution as U}from"./resolution-57e7767a.js";import{i as z}from"./skin-665ec17e.js";import"axios";import"js-cookie";import"ua-parser-js";import"@babel/runtime/helpers/toConsumableArray";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";import"@babel/runtime/helpers/assertThisInitialized";import"@babel/runtime/helpers/inherits";import"@babel/runtime/helpers/possibleConstructorReturn";import"@babel/runtime/helpers/getPrototypeOf";function F(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),t.push.apply(t,n)}return t}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))}))}return e}var K,X,G=function(e,o){var t=r(e);t&&o&&t.controlBar&&t.controlBar.progressControl.seekBar.on("click",(function(o){var t,i,r,l,a,s=this.el(),u=n.dom.getPointerPosition(s,o).x;n.getPlayer(e).controlBar.durationDisplay.options_.playerOptions.disableRemotePlayback=!1;var d=window.cast&&window.cast.framework&&window.cast.framework.CastSession,c=null===(t=window)||void 0===t||null===(i=t.cast)||void 0===i||null===(r=i.framework)||void 0===r||null===(l=r.CastContext)||void 0===l||null===(a=l.getInstance())||void 0===a?void 0:a.S;if(console.log(d),d&&"CONNECTED"===c){window.cast.framework.RemotePlayer.canSeek=!0;var v=new window.cast.framework.RemotePlayerController(window.cast.framework.RemotePlayer),m=v.h.media[0].liveSeekableRange.end;v.getSeekPosition(),window.cast.framework.RemotePlayer.currentTime=m*u,v.seek()}}))};function W(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),t.push.apply(t,n)}return t}var Q=[],Y=0,Z=null;function $(e,t,n){var i,r,a,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];X=(null==t||null===(i=t.watchHistory)||void 0===i?void 0:i.apiVersion)||"v1";var u=null==t||null===(r=t.watchHistory)||void 0===r?void 0:r.profileId,d=Math.floor(e.currentTime()),c=Math.floor(e.duration()),v=null==t||null===(a=t.watchHistory)||void 0===a?void 0:a.xapiKey,m={};"v1"==X?m={videoId:K,watchedTime:Math.floor(e.currentTime()),watchedPercentage:Math.floor(d/c*100),siteOwner:t.siteOwner,userId:t.userId,xApiKey:v}:"v2"==X&&(m=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?W(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))}))}return e}({videoId:K,watchedTime:Math.floor(e.currentTime()),watchedPercentage:s?100:Math.floor(d/c*100),doneWatching:s,profileId:u},Z&&{seriesId:Z})),l(m,t.token,X).then((function(e){})).catch((function(e){})),Y=d+n}var ee=function(e,o,t){var n=r(e);if(n)if(o>=0&&o<=100){n.muted()&&n.muted(!1);var i=parseFloat(o)/100;n.volume(i),t&&t({status:!0,msg:"Volume set to ".concat(o,"%")})}else t&&t({status:!1,msg:"Please enter a valid volume percentage (0 ≥ V ≤ 100)"});else t({status:!1,msg:"Cannot find player with id: '".concat(e,"'")})},oe=function(e){var o=r(e);return o?parseInt(100*o.volume())+"%":"Cannot find player with id: '".concat(e,"'")};function te(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),t.push.apply(t,n)}return t}var ne=function(e,t,n,i){var l,v,m=i.res,p=i.sres,f=r(e),w=(null==m||null===(l=m.video)||void 0===l||null===(v=l.streamingInfo)||void 0===v?void 0:v.isLiveStream)||!1;d(m),f.on("loadstart",(function(){w&&n.resolve({status:!0,msg:"Video Loaded",response:m})})),f.on("loadeddata",(function(){var i;(null==f||!f.muted())&&ee(e,sessionStorage.getItem("volume")||"100");var l,s,d=u();(a(),n.resolve(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))}))}return e}({status:!0,msg:"Player Initialised"},p?{seriesResponse:p,response:m}:{response:m})),null!=t&&t.watchHistory&&null!=t&&null!==(i=t.watchHistory)&&void 0!==i&&i.enable&&!t.isAnonymousUser)&&function(e,o,t){var n,i;null!=o&&o.series&&(Z=null==o||null===(n=o.series)||void 0===n?void 0:n.id),Q=[],Y=0,K=t;var l=(null==o||null===(i=o.watchHistory)||void 0===i?void 0:i.interval)||30,a=r(e);a&&(a.on("timeupdate",(function(){var e=Math.floor(a.currentTime());Q.includes(Y)||(e==Y?(Q.push(e),$(a,o,l)):e>Y&&(Y=e+l))})),a.on("ended",(function(){$(a,o,l,!0)})))}(e,t,null==d||null===(l=d.video)||void 0===l||null===(s=l.gist)||void 0===s?void 0:s.id)})),f.textTracks().on("change",(function(e){var o=this.tracks_.filter((function(e){if("subtitles"===e.kind&&"showing"===e.mode)return!0}))[0];f.trigger("subtitlechanged",o)})),f.on("subtitlechanged",(function(e,o){var t,n,i,r,l,a,s,u,d,c,v=window.cast&&window.cast.framework&&window.cast.framework.CastSession,m=null===(t=window)||void 0===t||null===(n=t.cast)||void 0===n||null===(i=n.framework)||void 0===i||null===(r=i.CastContext)||void 0===r||null===(l=r.getInstance())||void 0===l?void 0:l.S,p=null===(a=window)||void 0===a||null===(s=a.cast)||void 0===s||null===(u=s.framework)||void 0===u||null===(d=u.CastContext)||void 0===d||null===(c=d.getInstance())||void 0===c?void 0:c.getCurrentSession();if(v&&"CONNECTED"===m){var f,w=p.getMediaSession(),y=w.media.tracks.filter((function(e){return"TEXT"==e.type}));f=o?new chrome.cast.media.EditTracksInfoRequest([y[0].trackId]):new chrome.cast.media.EditTracksInfoRequest([]),w.editTracksInfo(f)}})),f.on("loadedmetadata",(function(){})),f.one("error",(function(){var o,t;s(e,(null==f||null===(o=f.error())||void 0===o?void 0:o.message)||"Some error occured"),n.reject({status:!1,msg:(null==f||null===(t=f.error())||void 0===t?void 0:t.message)||"Some error occured"})})),f.one("play",(function(){var e;if(null!=t&&null!==(e=t.series)&&void 0!==e&&e.enable){var o,n,i,r=null===(o=u())||void 0===o||null===(n=o.video)||void 0===n||null===(i=n.gist)||void 0===i?void 0:i.id,l=c().get(r)||{t:0,p:0},a=l.t,s=l.p;a&&s<95&&setTimeout((function(){f.currentTime(a)}),0)}else null!=t&&t.watchHistoryResumeTime&&(null==t?void 0:t.watchedPercentage)<95&&f.currentTime(null==t?void 0:t.watchHistoryResumeTime)})),f.on("volumechange",(function(){var e=100*f.volume().toFixed(2);f.muted()?sessionStorage.setItem("volume",0):sessionStorage.setItem("volume",e)}))},ie=function(e,o){var t=null==o?void 0:o.skin;"live"==t?import("./skin-fba79111.js").then((function(t){t.initialiseSkin(e,o)})):"default"==t?import("./skin-bb73c15b.js").then((function(t){t.initialiseSkin(e,o)})):"carousel"==t?import("./skin-851ea2fb.js").then((function(o){o.initaliseSkin(e)})):"defaultV2"==t?import("./skin-80957fd8.js").then((function(t){t.initialiseSkin(e,o)})):"multiplayer"==t&&import("./skin-0aea7a56.js").then((function(t){t.initialiseSkin(e,o)}))},re=function(e){return new Promise((function(o,t){if(le(e))t("".concat(e," is alread initialised"));else{var n=document.createElement("script");n.async=!1,n.src=e,document.head.appendChild(n),o()}}))},le=function(e){return document.querySelectorAll('script[src="'.concat(e,'"]')).length>0};function ae(){var e,o;null===(e=window)||void 0===e||null===(o=e.dataLayer)||void 0===o||o.push(arguments)}var se=function(e,o){o.controlBar.el_.style.color=e,o.controlBar.el_.querySelector(".vjs-play-progress")&&(o.controlBar.el_.querySelector(".vjs-play-progress").style.backgroundColor=e),o.controlBar.el_.querySelector(".vjs-volume-level")&&(o.controlBar.el_.querySelector(".vjs-volume-level").style.backgroundColor=e)};var ue,de=function(){var o=e(t.mark((function e(){return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,import("videojs-contrib-dash");case 2:case"end":return e.stop()}}),e)})));return function(){return o.apply(this,arguments)}}(),ce=function(){var o=e(t.mark((function e(){return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,import("videojs-contrib-eme");case 2:case"end":return e.stop()}}),e)})));return function(){return o.apply(this,arguments)}}(),ve=Object.freeze({__proto__:null,importChromecast:function(){import("@silvermine/videojs-chromecast").then((function(e){re("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1").then((function(){e.default(n)})).catch((function(e){console.log(e)}))}))},importAirplay:function(){import("@silvermine/videojs-airplay").then((function(e){e.default(n)}))},importIMA:function(){import("videojs-contrib-ads"),import("videojs-ima"),re("https://imasdk.googleapis.com/js/sdkloader/ima3.js").then((function(){})).catch((function(e){return console.log(e)}))},loadDashLibrary:de,loadEMELibrary:ce});function me(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),t.push.apply(t,n)}return t}function pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?me(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):me(Object(n)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))}))}return e}var fe=function(l,a,u,d){var c,v,m,p,f,w,y,h,b,k,O,j,P,I,C,D,E,x,R,B,L,H,_,M=a.res,N=void 0===M?null:M,q=a.sres,U=void 0===q?null:q,z=(null===(c=window)||void 0===c||null===(v=c.cast)||void 0===v||null===(m=v.framework)||void 0===m||null===(p=m.CastContext)||void 0===p||null===(f=p.getInstance())||void 0===f?void 0:f.S)||void 0,F=null!=u&&u.chromecastReceiverId?"NO_DEVICES_AVAILABLE"!==z&&"NOT_CONNECTED"!==z?["html5","chromecast"]:["chromecast","html5"]:["html5"],K=null==N||null===(w=N.video)||void 0===w||null===(y=w.gist)||void 0===y?void 0:y.videoImageUrl,X=(null==N||null===(h=N.video)||void 0===h||null===(b=h.liveDetails)||void 0===b?void 0:b.isDvrEnabled)||!1,W=function(e){var o,t={};return null!=e&&e.series||null!=e&&e.chromecastReceiverId&&null!==(o=window)&&void 0!==o&&o.cast&&(t={chromecast:{receiverAppID:null==e?void 0:e.chromecastReceiverId,addButtonToControlBar:"default"==e.skin||"defaultV2"==e.skin,buttonPositionIndex:-5,addCastLabelToButton:!0}}),null!=e&&e.airplay&&"Safari"==i()&&(t=J(J({},t),{},{airPlay:{addButtonToControlBar:"default"==e.skin,buttonPositionIndex:-6}})),t}(u),Q=(null==N||null===(k=N.video)||void 0===k||null===(O=k.streamingInfo)||void 0===O?void 0:O.isLiveStream)||!1,Y=(null==u?void 0:u.drmLibrary)||!1,Z=(null==N||null===(j=N.ads)||void 0===j||null===(P=j.preRoll)||void 0===P||null===(I=P.adTags)||void 0===I||null===(C=I.web)||void 0===C?void 0:C.active)&&(null==N||null===(D=N.ads)||void 0===D||null===(E=D.preRoll)||void 0===E||null===(x=E.adTags)||void 0===x||null===(R=x.web)||void 0===R?void 0:R.url),$=(_={controls:0!=(null==u?void 0:u.controls),playsinline:!0,fluid:!0,muted:(null==u?void 0:u.muted)||!1,autoplay:(null==u?void 0:u.autoplay)||!1,controlBar:{volumePanel:("default"==u.skin||"defaultV2"==u.skin||"live"==(null==u?void 0:u.skin))&&{inline:!1},fullscreenToggle:"default"==u.skin||"defaultV2"==u.skin,audioTrackButton:!1,pictureInPictureToggle:(u.skin,!1)},muteToggle:"multiplayer"==u.skin,liveui:X},o(_,"autoplay",null==u?void 0:u.autoplay),o(_,"normalizeAutoplay",(null==u?void 0:u.autoplay)&&!Z),o(_,"loop",(null==u?void 0:u.loop)||!1),o(_,"html5",pe(pe({vhs:pe(pe({experimentalLLHLS:(null==u?void 0:u.lowLatency)||!1,limitRenditionByPlayerDimensions:!0,useDevicePixelRatio:!0,useNetworkInformationApi:!0},(null==u||null===(B=u.customData)||void 0===B?void 0:B.overrideNative)&&{overrideNative:!0}),{},{enableLowInitialPlaylist:(null==u?void 0:u.enableLowInitialPlaylist)||!1})},0==(null==u||null===(L=u.customData)||void 0===L?void 0:L.nativeAudioTracks)&&{nativeAudioTracks:!1}),0==(null==u||null===(H=u.customData)||void 0===H?void 0:H.nativeVideoTracks)&&{nativeVideoTracks:!1})),o(_,"poster",K),o(_,"techOrder",F),o(_,"chromecast",{requestCustomDataFn:function(e){var o=r(l);console.log(o.textTracksJson_);var t=o.textTracksJson_.filter((function(e){return"subtitles"==e.kind}));return function(e,o,t){var n,i,r,l,a,s,u,d,c,v,m={};if(e&&e.video&&e.video.drmEnabled){m.isDrmEnabled=!0;var p=o.keySystemOptions&&o.keySystemOptions[0]&&o.keySystemOptions[0].options&&o.keySystemOptions[0].options.serverURL;m.licenseUrl=p;var f=o.keySystemOptions&&o.keySystemOptions[0]&&o.keySystemOptions[0].options&&o.keySystemOptions[0].options.httpRequestHeaders["X-AxDRM-Message"];m.licenseToken=f}var w=(null==e||null===(n=e.video)||void 0===n||null===(i=n.gist)||void 0===i?void 0:i.contentType)||"VIDEO";m.contentType=w;var y=null==e||null===(r=e.video)||void 0===r||null===(l=r.gist)||void 0===l?void 0:l.runtime;m.duration=y;var h=null==e||null===(a=e.video)||void 0===a||null===(s=a.gist)||void 0===s?void 0:s.title;m.mediaTitle=h;var g=null==e||null===(u=e.video)||void 0===u||null===(d=u.gist)||void 0===d?void 0:d.videoImageUrl;return m.mediaImage=g,m.subTitles=t,m.DVR=(null==e||null===(c=e.video)||void 0===c||null===(v=c.liveDetails)||void 0===v?void 0:v.isDvrEnabled)||!1,console.log(m),m}(N,e,t)}}),o(_,"plugins",W),_),ee=n(l,$,function(){var o=e(t.mark((function e(){var o,r,a,c,v,m,p,f,w,y,h,b,k,O,j,P,I;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Q&&d.resolve(pe({status:!0,msg:"Player Initialised"},U?{seriesResponse:U,response:N}:{response:N})),"white"!==window.controlsColor&&se(window.controlsColor,ee),/Android/i.test(navigator.userAgent)&&(n.options.vhs.overrideNative=!0),y=null==N||null===(o=N.video)||void 0===o?void 0:o.drmEnabled,h=null==N||null===(r=N.video)||void 0===r||null===(a=r.liveDetails)||void 0===a?void 0:a.startOverTime,!y&&!Y){e.next=13;break}if("Safari"!==i()){e.next=11;break}return e.next=9,ce();case 9:e.next=13;break;case 11:return e.next=13,Promise.all([ce(),de()]);case 13:X&&G(l,h),!Z||null!=u&&null!==(c=u.customData)&&void 0!==c&&c.disableAds||V(l,Z,N),b=T(N,l),(null==b?void 0:b.src).replace("us-e","a-m"),b?g(l,b):(d.reject({status:!1,msg:"Incompatible Source, only hls,mp4,drm content is allowed",response:N}),s(l,"Incompatible Source, only hls,mp4,drm content is allowed")),((null==N||null===(v=N.video)||void 0===v||null===(m=v.contentDetails)||void 0===m||null===(p=m.closedCaptions)||void 0===p?void 0:p.length)>0||(null==N||null===(f=N.video)||void 0===f||null===(w=f.closedCaptions)||void 0===w?void 0:w.length)>0)&&(I=(null==N||null===(O=N.video)||void 0===O||null===(j=O.contentDetails)||void 0===j?void 0:j.closedCaptions)||(null==N||null===(P=N.video)||void 0===P?void 0:P.closedCaptions),k=I.filter((function(e){return"VTT"===e.format})),A(l,k)),null!=u&&u.disableControls?S(l):ie(l,pe(pe(pe({},u),$),{},{liveVideo:Q,isDvrEnabled:X,res:N,sres:U})),ne(l,pe(pe(pe({},u),$),{},{liveVideo:Q}),d,{res:N,sres:U});case 22:case"end":return e.stop()}}),e)})));return function(){return o.apply(this,arguments)}}())};function we(){return{loadVideoInstantly:p,onTimeUpdate:L,getVideoDuration:H,onVideoEnded:_,init:function(e){return new Promise((function(o,t){var n,r,l,a,s,u,c,p,f;if(!b(null==e?void 0:e.playerId)){var w=null==e?void 0:e.videoId,y=(null==e||null===(n=e.series)||void 0===n?void 0:n.enable)||!1;window.videoId=w;var h=null==e?void 0:e.token;if(h&&!C(h)){ue=JSON.parse(atob(h.split(".")[1])),window.siteId=null===(r=ue)||void 0===r?void 0:r.siteId,window.siteName=null===(l=ue)||void 0===l?void 0:l.site,e.isAnonymousUser=!(null===(a=ue)||void 0===a||!a.anonymousId),e.siteOwner=(null===(s=ue)||void 0===s?void 0:s.site)||null,e.userId=(null===(u=ue)||void 0===u?void 0:u.userId)||null,window.sessionStorage.setItem("uid",null===(c=ue)||void 0===c?void 0:c.userId),window.watchHistory=e.watchHistory||null,sessionStorage.setItem("token",h);var g=null==e?void 0:e.playerId,k=e.chromecastReceiverId=null!=e&&e.series?null:null==e?void 0:e.chromecastReceiverId,O=null==e?void 0:e.airplay,j=null==e?void 0:e.apiBaseUrl,P=(null==e||null===(p=e.analytics)||void 0===p?void 0:p.gaId)||null,I=null==e?void 0:e.errors;I&&(window.customErrors=I),window.customData=null==e?void 0:e.customData,j&&(window.playerEntitlementUrl=j),window.controlsColor=(null==e?void 0:e.controlsColor)||"white",null!=e&&e.skin&&!z(e.skin)||(e.skin="defaultV2"),Promise.resolve().then((function(){return ve})).then((function(e){e.importIMA()})),!k||null!=e&&e.series||Promise.resolve().then((function(){return ve})).then((function(e){e.importChromecast()})),O&&"Safari"==i()&&Promise.resolve().then((function(){return ve})).then((function(e){e.importAirplay()})),P&&re("https://www.googletagmanager.com/gtag/js?id=".concat(P)).then((function(){return e=P,window.dataLayer=window.dataLayer||[],ae("js",new Date),void ae("config",e);var e})).catch((function(e){}));var T=null===(f=document)||void 0===f?void 0:f.getElementById("".concat(g));if(T&&T.addEventListener("contextmenu",(function(e){return e.preventDefault()})),y){var S,V=null==e||null===(S=e.series)||void 0===S?void 0:S.id;D(V,h).then((function(n){var i,r,l,a=n.data,s=n.data.seasons;B(s);var u=w||(null==s||null===(i=s[0])||void 0===i||null===(r=i.episodes)||void 0===r||null===(l=r[0])||void 0===l?void 0:l.id);!function(e,o){var t=new Map;v({videoId:e,token:o}).then((function(e){e.data.map((function(e){t.set(e.videoId,{t:e.watchedTime,p:e.watchedPercentage})})),m(t)})).catch((function(e){return console.log(e)}))}(V,h),E(u,h).then((function(n){var i,r,l;window.contentType=null==n||null===(i=n.data)||void 0===i||null===(r=i.video)||void 0===r||null===(l=r.gist)||void 0===l?void 0:l.contentType,d(n.data),fe(g,{res:null==n?void 0:n.data,sres:a},e,{resolve:o,reject:t})})).catch((function(e){x(e,g,t,w)}))})).catch((function(e){x(e,g,t)}))}else E(w,h).then((function(n){var i,r,l,a;window.contentType=null==n||null===(i=n.data)||void 0===i||null===(r=i.video)||void 0===r||null===(l=r.gist)||void 0===l?void 0:l.contentType,d(null==n?void 0:n.data);var s=null==n?void 0:n.data;null!=e&&e.watchHistory&&null!=e&&null!==(a=e.watchHistory)&&void 0!==a&&a.enable?R(w,h).then((function(n){var i,r,l,a,u,d;null!==(i=window)&&void 0!==i&&null!==(r=i.watchHistory)&&void 0!==r&&r.cb&&(null===(l=window)||void 0===l||null===(a=l.watchHistory)||void 0===a||a.cb(null==n?void 0:n.data)),e.watchHistoryResumeTime=(null==n||null===(u=n.data)||void 0===u?void 0:u.watchedTime)||null,e.watchedPercentage=(null==n||null===(d=n.data)||void 0===d?void 0:d.watchedPercentage)||null,fe(g,{res:s},e,{resolve:o,reject:t})})).catch((function(n){var i,r,l,a;null!==(i=window)&&void 0!==i&&null!==(r=i.watchHistory)&&void 0!==r&&r.cb&&(null===(l=window)||void 0===l||null===(a=l.watchHistory)||void 0===a||a.cb(n)),fe(g,{res:s},e,{resolve:o,reject:t})})):fe(g,{res:s},e,{resolve:o,reject:t})})).catch((function(e){x(e,g,t,w)}))}else t({status:!1,msg:"".concat(h?"Token is expired !":"Missing Authorization Token"),response:{token:h}})}}))},getRenditions:q,skip:f,getPlayer:r,play:w,pause:y,detectBrowser:i,rewind:h,loadVideo:g,seekToTimeStamp:M,isPlayerInitialised:b,load:k,dispose:O,enableCaptions:j,disableCaptions:P,getCaptions:I,playSelectedResolution:U,getSource:T,setVolume:ee,getVolume:oe,disableControls:S,setPlaybackSpeed:N}}export{we as default};
1
+ import"video.js/dist/video-js.min.css";import e from"@babel/runtime/helpers/asyncToGenerator";import o from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/regenerator";import n from"video.js";import{d as i,g as r,s as l,c as a,h as s,a as u,b as d,e as c,f as v,i as m,l as p,j as f,p as w,k as y,r as h,m as g,n as b,o as k,q as O,t as j,u as P,v as I,w as T,x as S,y as C,z as D,A as E,B as x,C as R,D as V,E as A,F as B}from"./generic-4a3c0d6b.js";import{o as L,g as H,a as _,s as M,b as N}from"./util-9c9ee6b3.js";import{g as q}from"./renditions-0fdb57ed.js";import{playSelectedResolution as U}from"./resolution-57e7767a.js";import{i as z}from"./skin-665ec17e.js";import"axios";import"js-cookie";import"ua-parser-js";import"@babel/runtime/helpers/toConsumableArray";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";import"@babel/runtime/helpers/assertThisInitialized";import"@babel/runtime/helpers/inherits";import"@babel/runtime/helpers/possibleConstructorReturn";import"@babel/runtime/helpers/getPrototypeOf";function F(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),t.push.apply(t,n)}return t}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))}))}return e}var K,X,G=function(e,o){var t=r(e);t&&o&&t.controlBar&&t.controlBar.progressControl.seekBar.on("click",(function(o){var t,i,r,l,a,s=this.el(),u=n.dom.getPointerPosition(s,o).x;n.getPlayer(e).controlBar.durationDisplay.options_.playerOptions.disableRemotePlayback=!1;var d=window.cast&&window.cast.framework&&window.cast.framework.CastSession,c=null===(t=window)||void 0===t||null===(i=t.cast)||void 0===i||null===(r=i.framework)||void 0===r||null===(l=r.CastContext)||void 0===l||null===(a=l.getInstance())||void 0===a?void 0:a.S;if(console.log(d),d&&"CONNECTED"===c){window.cast.framework.RemotePlayer.canSeek=!0;var v=new window.cast.framework.RemotePlayerController(window.cast.framework.RemotePlayer),m=v.h.media[0].liveSeekableRange.end;v.getSeekPosition(),window.cast.framework.RemotePlayer.currentTime=m*u,v.seek()}}))};function W(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),t.push.apply(t,n)}return t}var Q=[],Y=0,Z=null;function $(e,t,n){var i,r,a,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];X=(null==t||null===(i=t.watchHistory)||void 0===i?void 0:i.apiVersion)||"v1";var u=null==t||null===(r=t.watchHistory)||void 0===r?void 0:r.profileId,d=Math.floor(e.currentTime()),c=Math.floor(e.duration()),v=null==t||null===(a=t.watchHistory)||void 0===a?void 0:a.xapiKey,m={};"v1"==X?m={videoId:K,watchedTime:Math.floor(e.currentTime()),watchedPercentage:Math.floor(d/c*100),siteOwner:t.siteOwner,userId:t.userId,xApiKey:v}:"v2"==X&&(m=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?W(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))}))}return e}({videoId:K,watchedTime:Math.floor(e.currentTime()),watchedPercentage:s?100:Math.floor(d/c*100),doneWatching:s,profileId:u},Z&&{seriesId:Z})),l(m,t.token,X).then((function(e){})).catch((function(e){})),Y=d+n}var ee=function(e,o,t){var n=r(e);if(n)if(o>=0&&o<=100){n.muted()&&n.muted(!1);var i=parseFloat(o)/100;n.volume(i),t&&t({status:!0,msg:"Volume set to ".concat(o,"%")})}else t&&t({status:!1,msg:"Please enter a valid volume percentage (0 ≥ V ≤ 100)"});else t({status:!1,msg:"Cannot find player with id: '".concat(e,"'")})},oe=function(e){var o=r(e);return o?parseInt(100*o.volume())+"%":"Cannot find player with id: '".concat(e,"'")};function te(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),t.push.apply(t,n)}return t}var ne=function(e,t,n,i){var l,v,m=i.res,p=i.sres,f=r(e),w=(null==m||null===(l=m.video)||void 0===l||null===(v=l.streamingInfo)||void 0===v?void 0:v.isLiveStream)||!1;d(m),f.on("loadstart",(function(){w&&n.resolve({status:!0,msg:"Video Loaded",response:m})})),f.on("loadeddata",(function(){var i;(null==f||!f.muted())&&ee(e,sessionStorage.getItem("volume")||"100");var l,s,d=u();(a(),n.resolve(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))}))}return e}({status:!0,msg:"Player Initialised"},p?{seriesResponse:p,response:m}:{response:m})),null!=t&&t.watchHistory&&null!=t&&null!==(i=t.watchHistory)&&void 0!==i&&i.enable&&!t.isAnonymousUser)&&function(e,o,t){var n,i;null!=o&&o.series&&(Z=null==o||null===(n=o.series)||void 0===n?void 0:n.id),Q=[],Y=0,K=t;var l=(null==o||null===(i=o.watchHistory)||void 0===i?void 0:i.interval)||30,a=r(e);a&&(a.on("timeupdate",(function(){var e=Math.floor(a.currentTime());Q.includes(Y)||(e==Y?(Q.push(e),$(a,o,l)):e>Y&&(Y=e+l))})),a.on("ended",(function(){$(a,o,l,!0)})))}(e,t,null==d||null===(l=d.video)||void 0===l||null===(s=l.gist)||void 0===s?void 0:s.id)})),f.textTracks().on("change",(function(e){var o=this.tracks_.filter((function(e){if("subtitles"===e.kind&&"showing"===e.mode)return!0}))[0];f.trigger("subtitlechanged",o)})),f.on("subtitlechanged",(function(e,o){var t,n,i,r,l,a,s,u,d,c,v=window.cast&&window.cast.framework&&window.cast.framework.CastSession,m=null===(t=window)||void 0===t||null===(n=t.cast)||void 0===n||null===(i=n.framework)||void 0===i||null===(r=i.CastContext)||void 0===r||null===(l=r.getInstance())||void 0===l?void 0:l.S,p=null===(a=window)||void 0===a||null===(s=a.cast)||void 0===s||null===(u=s.framework)||void 0===u||null===(d=u.CastContext)||void 0===d||null===(c=d.getInstance())||void 0===c?void 0:c.getCurrentSession();if(v&&"CONNECTED"===m){var f,w=p.getMediaSession(),y=w.media.tracks.filter((function(e){return"TEXT"==e.type}));f=o?new chrome.cast.media.EditTracksInfoRequest([y[0].trackId]):new chrome.cast.media.EditTracksInfoRequest([]),w.editTracksInfo(f)}})),f.on("loadedmetadata",(function(){})),f.one("error",(function(){var o,t;s(e,(null==f||null===(o=f.error())||void 0===o?void 0:o.message)||"Some error occured"),n.reject({status:!1,msg:(null==f||null===(t=f.error())||void 0===t?void 0:t.message)||"Some error occured"})})),f.one("play",(function(){var e;if(null!=t&&null!==(e=t.series)&&void 0!==e&&e.enable){var o,n,i,r=null===(o=u())||void 0===o||null===(n=o.video)||void 0===n||null===(i=n.gist)||void 0===i?void 0:i.id,l=c().get(r)||{t:0,p:0},a=l.t,s=l.p;a&&s<95&&setTimeout((function(){f.currentTime(a)}),0)}else null!=t&&t.watchHistoryResumeTime&&(null==t?void 0:t.watchedPercentage)<95&&f.currentTime(null==t?void 0:t.watchHistoryResumeTime)})),f.on("volumechange",(function(){var e=100*f.volume().toFixed(2);f.muted()?sessionStorage.setItem("volume",0):sessionStorage.setItem("volume",e)}))},ie=function(e,o){var t=null==o?void 0:o.skin;"live"==t?import("./skin-fba79111.js").then((function(t){t.initialiseSkin(e,o)})):"default"==t?import("./skin-bb73c15b.js").then((function(t){t.initialiseSkin(e,o)})):"carousel"==t?import("./skin-851ea2fb.js").then((function(o){o.initaliseSkin(e)})):"defaultV2"==t?import("./skin-80957fd8.js").then((function(t){t.initialiseSkin(e,o)})):"multiplayer"==t&&import("./skin-0aea7a56.js").then((function(t){t.initialiseSkin(e,o)}))},re=function(e){return new Promise((function(o,t){if(le(e))t("".concat(e," is alread initialised"));else{var n=document.createElement("script");n.async=!1,n.src=e,document.head.appendChild(n),o()}}))},le=function(e){return document.querySelectorAll('script[src="'.concat(e,'"]')).length>0};function ae(){var e,o;null===(e=window)||void 0===e||null===(o=e.dataLayer)||void 0===o||o.push(arguments)}var se=function(e,o){o.controlBar.el_.style.color=e,o.controlBar.el_.querySelector(".vjs-play-progress")&&(o.controlBar.el_.querySelector(".vjs-play-progress").style.backgroundColor=e),o.controlBar.el_.querySelector(".vjs-volume-level")&&(o.controlBar.el_.querySelector(".vjs-volume-level").style.backgroundColor=e)};var ue,de=function(){var o=e(t.mark((function e(){return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,import("videojs-contrib-dash");case 2:case"end":return e.stop()}}),e)})));return function(){return o.apply(this,arguments)}}(),ce=function(){var o=e(t.mark((function e(){return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,import("videojs-contrib-eme");case 2:case"end":return e.stop()}}),e)})));return function(){return o.apply(this,arguments)}}(),ve=Object.freeze({__proto__:null,importChromecast:function(){import("@silvermine/videojs-chromecast").then((function(e){re("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1").then((function(){e.default(n)})).catch((function(e){console.log(e)}))}))},importAirplay:function(){import("@silvermine/videojs-airplay").then((function(e){e.default(n)}))},importIMA:function(){import("videojs-contrib-ads"),import("videojs-ima"),re("https://imasdk.googleapis.com/js/sdkloader/ima3.js").then((function(){})).catch((function(e){return console.log(e)}))},loadDashLibrary:de,loadEMELibrary:ce});function me(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),t.push.apply(t,n)}return t}function pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?me(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):me(Object(n)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))}))}return e}var fe=function(l,a,u,d){var c,v,m,p,f,w,y,h,b,k,O,j,P,I,C,D,E,x,R,B,L,H,_,M=a.res,N=void 0===M?null:M,q=a.sres,U=void 0===q?null:q,z=(null===(c=window)||void 0===c||null===(v=c.cast)||void 0===v||null===(m=v.framework)||void 0===m||null===(p=m.CastContext)||void 0===p||null===(f=p.getInstance())||void 0===f?void 0:f.S)||void 0,F=null!=u&&u.chromecastReceiverId?"NO_DEVICES_AVAILABLE"!==z&&"NOT_CONNECTED"!==z?["html5","chromecast"]:["chromecast","html5"]:["html5"],K=null==N||null===(w=N.video)||void 0===w||null===(y=w.gist)||void 0===y?void 0:y.videoImageUrl,X=(null==N||null===(h=N.video)||void 0===h||null===(b=h.liveDetails)||void 0===b?void 0:b.isDvrEnabled)||!1,W=function(e){var o,t={};return null!=e&&e.series||null!=e&&e.chromecastReceiverId&&null!==(o=window)&&void 0!==o&&o.cast&&(t={chromecast:{receiverAppID:null==e?void 0:e.chromecastReceiverId,addButtonToControlBar:"default"==e.skin||"defaultV2"==e.skin,buttonPositionIndex:-5,addCastLabelToButton:!0}}),null!=e&&e.airplay&&"Safari"==i()&&(t=J(J({},t),{},{airPlay:{addButtonToControlBar:"default"==e.skin,buttonPositionIndex:-6}})),t}(u),Q=(null==N||null===(k=N.video)||void 0===k||null===(O=k.streamingInfo)||void 0===O?void 0:O.isLiveStream)||!1,Y=(null==u?void 0:u.drmLibrary)||!1,Z=(null==N||null===(j=N.ads)||void 0===j||null===(P=j.preRoll)||void 0===P||null===(I=P.adTags)||void 0===I||null===(C=I.web)||void 0===C?void 0:C.active)&&(null==N||null===(D=N.ads)||void 0===D||null===(E=D.preRoll)||void 0===E||null===(x=E.adTags)||void 0===x||null===(R=x.web)||void 0===R?void 0:R.url),$=(_={controls:0!=(null==u?void 0:u.controls),playsinline:!0,fluid:!0,muted:(null==u?void 0:u.muted)||!1,autoplay:(null==u?void 0:u.autoplay)||!1,controlBar:{volumePanel:("default"==u.skin||"defaultV2"==u.skin||"live"==(null==u?void 0:u.skin))&&{inline:!1},fullscreenToggle:"default"==u.skin||"defaultV2"==u.skin,audioTrackButton:!1,pictureInPictureToggle:(u.skin,!1)},muteToggle:"multiplayer"==u.skin,liveui:X},o(_,"autoplay",null==u?void 0:u.autoplay),o(_,"normalizeAutoplay",(null==u?void 0:u.autoplay)&&!Z),o(_,"loop",(null==u?void 0:u.loop)||!1),o(_,"html5",pe(pe({vhs:pe(pe({experimentalLLHLS:(null==u?void 0:u.lowLatency)||!1,limitRenditionByPlayerDimensions:!0,useDevicePixelRatio:!0,useNetworkInformationApi:!0},(null==u||null===(B=u.customData)||void 0===B?void 0:B.overrideNative)&&{overrideNative:!0}),{},{enableLowInitialPlaylist:(null==u?void 0:u.enableLowInitialPlaylist)||!1})},0==(null==u||null===(L=u.customData)||void 0===L?void 0:L.nativeAudioTracks)&&{nativeAudioTracks:!1}),0==(null==u||null===(H=u.customData)||void 0===H?void 0:H.nativeVideoTracks)&&{nativeVideoTracks:!1})),o(_,"poster",K),o(_,"techOrder",F),o(_,"chromecast",{requestCustomDataFn:function(e){var o=r(l);console.log(o.textTracksJson_);var t=o.textTracksJson_.filter((function(e){return"subtitles"==e.kind}));return function(e,o,t){var n,i,r,l,a,s,u,d,c,v,m={};if(e&&e.video&&e.video.drmEnabled){m.isDrmEnabled=!0;var p=o.keySystemOptions&&o.keySystemOptions[0]&&o.keySystemOptions[0].options&&o.keySystemOptions[0].options.serverURL;m.licenseUrl=p;var f=o.keySystemOptions&&o.keySystemOptions[0]&&o.keySystemOptions[0].options&&o.keySystemOptions[0].options.httpRequestHeaders["X-AxDRM-Message"];m.licenseToken=f}var w=(null==e||null===(n=e.video)||void 0===n||null===(i=n.gist)||void 0===i?void 0:i.contentType)||"VIDEO";m.contentType=w;var y=null==e||null===(r=e.video)||void 0===r||null===(l=r.gist)||void 0===l?void 0:l.runtime;m.duration=y;var h=null==e||null===(a=e.video)||void 0===a||null===(s=a.gist)||void 0===s?void 0:s.title;m.mediaTitle=h;var g=null==e||null===(u=e.video)||void 0===u||null===(d=u.gist)||void 0===d?void 0:d.videoImageUrl;return m.mediaImage=g,m.subTitles=t,m.DVR=(null==e||null===(c=e.video)||void 0===c||null===(v=c.liveDetails)||void 0===v?void 0:v.isDvrEnabled)||!1,console.log(m),m}(N,e,t)}}),o(_,"plugins",W),_),ee=n(l,$,function(){var o=e(t.mark((function e(){var o,r,a,c,v,m,p,f,w,y,h,b,k,O,j,P,I;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Q&&d.resolve(pe({status:!0,msg:"Player Initialised"},U?{seriesResponse:U,response:N}:{response:N})),"white"!==window.controlsColor&&se(window.controlsColor,ee),/Android/i.test(navigator.userAgent)&&(n.options.vhs.overrideNative=!0),y=null==N||null===(o=N.video)||void 0===o?void 0:o.drmEnabled,h=null==N||null===(r=N.video)||void 0===r||null===(a=r.liveDetails)||void 0===a?void 0:a.startOverTime,!y&&!Y){e.next=13;break}if("Safari"!==i()){e.next=11;break}return e.next=9,ce();case 9:e.next=13;break;case 11:return e.next=13,Promise.all([ce(),de()]);case 13:X&&G(l,h),!Z||null!=u&&null!==(c=u.customData)&&void 0!==c&&c.disableAds||V(l,Z,N),b=T(N,l),"IN"==u.countryCode&&(n.Vhs.xhr.beforeRequest=function(e){e.uri=e.uri.replace("us-e","a-m")}),b?g(l,b):(d.reject({status:!1,msg:"Incompatible Source, only hls,mp4,drm content is allowed",response:N}),s(l,"Incompatible Source, only hls,mp4,drm content is allowed")),((null==N||null===(v=N.video)||void 0===v||null===(m=v.contentDetails)||void 0===m||null===(p=m.closedCaptions)||void 0===p?void 0:p.length)>0||(null==N||null===(f=N.video)||void 0===f||null===(w=f.closedCaptions)||void 0===w?void 0:w.length)>0)&&(I=(null==N||null===(O=N.video)||void 0===O||null===(j=O.contentDetails)||void 0===j?void 0:j.closedCaptions)||(null==N||null===(P=N.video)||void 0===P?void 0:P.closedCaptions),k=I.filter((function(e){return"VTT"===e.format})),A(l,k)),null!=u&&u.disableControls?S(l):ie(l,pe(pe(pe({},u),$),{},{liveVideo:Q,isDvrEnabled:X,res:N,sres:U})),ne(l,pe(pe(pe({},u),$),{},{liveVideo:Q}),d,{res:N,sres:U});case 21:case"end":return e.stop()}}),e)})));return function(){return o.apply(this,arguments)}}())};function we(){return{loadVideoInstantly:p,onTimeUpdate:L,getVideoDuration:H,onVideoEnded:_,init:function(e){return new Promise((function(o,t){var n,r,l,a,s,u,c,p,f;if(!b(null==e?void 0:e.playerId)){var w=null==e?void 0:e.videoId,y=(null==e||null===(n=e.series)||void 0===n?void 0:n.enable)||!1;window.videoId=w;var h=null==e?void 0:e.token;if(h&&!C(h)){ue=JSON.parse(atob(h.split(".")[1])),window.siteId=null===(r=ue)||void 0===r?void 0:r.siteId,window.siteName=null===(l=ue)||void 0===l?void 0:l.site,e.isAnonymousUser=!(null===(a=ue)||void 0===a||!a.anonymousId),e.siteOwner=(null===(s=ue)||void 0===s?void 0:s.site)||null,e.userId=(null===(u=ue)||void 0===u?void 0:u.userId)||null,window.sessionStorage.setItem("uid",null===(c=ue)||void 0===c?void 0:c.userId),window.watchHistory=e.watchHistory||null,sessionStorage.setItem("token",h);var g=null==e?void 0:e.playerId,k=e.chromecastReceiverId=null!=e&&e.series?null:null==e?void 0:e.chromecastReceiverId,O=null==e?void 0:e.airplay,j=null==e?void 0:e.apiBaseUrl,P=(null==e||null===(p=e.analytics)||void 0===p?void 0:p.gaId)||null,I=null==e?void 0:e.errors;I&&(window.customErrors=I),window.customData=null==e?void 0:e.customData,j&&(window.playerEntitlementUrl=j),window.controlsColor=(null==e?void 0:e.controlsColor)||"white",null!=e&&e.skin&&!z(e.skin)||(e.skin="defaultV2"),Promise.resolve().then((function(){return ve})).then((function(e){e.importIMA()})),!k||null!=e&&e.series||Promise.resolve().then((function(){return ve})).then((function(e){e.importChromecast()})),O&&"Safari"==i()&&Promise.resolve().then((function(){return ve})).then((function(e){e.importAirplay()})),P&&re("https://www.googletagmanager.com/gtag/js?id=".concat(P)).then((function(){return e=P,window.dataLayer=window.dataLayer||[],ae("js",new Date),void ae("config",e);var e})).catch((function(e){}));var T=null===(f=document)||void 0===f?void 0:f.getElementById("".concat(g));if(T&&T.addEventListener("contextmenu",(function(e){return e.preventDefault()})),y){var S,V=null==e||null===(S=e.series)||void 0===S?void 0:S.id;D(V,h).then((function(n){var i,r,l,a=n.data,s=n.data.seasons;B(s);var u=w||(null==s||null===(i=s[0])||void 0===i||null===(r=i.episodes)||void 0===r||null===(l=r[0])||void 0===l?void 0:l.id);!function(e,o){var t=new Map;v({videoId:e,token:o}).then((function(e){e.data.map((function(e){t.set(e.videoId,{t:e.watchedTime,p:e.watchedPercentage})})),m(t)})).catch((function(e){return console.log(e)}))}(V,h),E(u,h).then((function(n){var i,r,l;window.contentType=null==n||null===(i=n.data)||void 0===i||null===(r=i.video)||void 0===r||null===(l=r.gist)||void 0===l?void 0:l.contentType,d(n.data),fe(g,{res:null==n?void 0:n.data,sres:a},e,{resolve:o,reject:t})})).catch((function(e){x(e,g,t,w)}))})).catch((function(e){x(e,g,t)}))}else E(w,h).then((function(n){var i,r,l,a;window.contentType=null==n||null===(i=n.data)||void 0===i||null===(r=i.video)||void 0===r||null===(l=r.gist)||void 0===l?void 0:l.contentType,d(null==n?void 0:n.data);var s=null==n?void 0:n.data;null!=e&&e.watchHistory&&null!=e&&null!==(a=e.watchHistory)&&void 0!==a&&a.enable?R(w,h).then((function(n){var i,r,l,a,u,d;null!==(i=window)&&void 0!==i&&null!==(r=i.watchHistory)&&void 0!==r&&r.cb&&(null===(l=window)||void 0===l||null===(a=l.watchHistory)||void 0===a||a.cb(null==n?void 0:n.data)),e.watchHistoryResumeTime=(null==n||null===(u=n.data)||void 0===u?void 0:u.watchedTime)||null,e.watchedPercentage=(null==n||null===(d=n.data)||void 0===d?void 0:d.watchedPercentage)||null,fe(g,{res:s},e,{resolve:o,reject:t})})).catch((function(n){var i,r,l,a;null!==(i=window)&&void 0!==i&&null!==(r=i.watchHistory)&&void 0!==r&&r.cb&&(null===(l=window)||void 0===l||null===(a=l.watchHistory)||void 0===a||a.cb(n)),fe(g,{res:s},e,{resolve:o,reject:t})})):fe(g,{res:s},e,{resolve:o,reject:t})})).catch((function(e){x(e,g,t,w)}))}else t({status:!1,msg:"".concat(h?"Token is expired !":"Missing Authorization Token"),response:{token:h}})}}))},getRenditions:q,skip:f,getPlayer:r,play:w,pause:y,detectBrowser:i,rewind:h,loadVideo:g,seekToTimeStamp:M,isPlayerInitialised:b,load:k,dispose:O,enableCaptions:j,disableCaptions:P,getCaptions:I,playSelectedResolution:U,getSource:T,setVolume:ee,getVolume:oe,disableControls:S,setPlaybackSpeed:N}}export{we as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viewlift/player-backup",
3
- "version": "0.0.93",
3
+ "version": "0.0.95",
4
4
  "main": "dist/bundle.cjs.js",
5
5
  "amdName": "_playerCore",
6
6
  "dependencies": {