@viewlift/player-backup 1.0.0-lighteningjs → 1.0.0

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.
Files changed (105) hide show
  1. package/cjs/autoNextVideo-823821e8.js +1 -0
  2. package/cjs/bundle.css +657 -0
  3. package/cjs/caption-settings-67212c17.js +1 -0
  4. package/cjs/caption-settings-d42c056e.js +1 -0
  5. package/cjs/debugSelection-cbfdabb7.js +1 -0
  6. package/cjs/dvr_skin-f7f770ae.js +1 -0
  7. package/cjs/error-26d5a3c3.js +1 -0
  8. package/cjs/features-164c3cc6.js +1 -0
  9. package/cjs/generic-8b99b151.js +1 -0
  10. package/cjs/icons-7afb9c13.js +1 -0
  11. package/cjs/index-3dfe6459.js +1 -0
  12. package/cjs/index.js +1 -0
  13. package/cjs/keyboardShortcuts-cfd998c2.js +1 -0
  14. package/cjs/loader-393b838a.js +1 -0
  15. package/cjs/multicam-21c9a90b.js +1 -0
  16. package/cjs/multicam-a41fe4a6.js +1 -0
  17. package/cjs/multicamv2-76d8530b.js +1 -0
  18. package/cjs/multicamv2-c148fa24.js +1 -0
  19. package/cjs/mwebPotrait-3c11d7cf.js +1 -0
  20. package/cjs/mwebPotraitTray-b9d5d45a.js +1 -0
  21. package/cjs/nextEpisodeButton-300afadc.js +1 -0
  22. package/cjs/nextEpisodeButton-b6e6586f.js +1 -0
  23. package/cjs/nondvr_skin-ef2cb3b2.js +1 -0
  24. package/cjs/playlist-925f808b.js +1 -0
  25. package/cjs/playlist-df87ca90.js +1 -0
  26. package/cjs/renditions-bc841552.js +1 -0
  27. package/cjs/resolution-6a9adf54.js +1 -0
  28. package/cjs/series-82ec79d3.js +1 -0
  29. package/cjs/series-9c237975.js +1 -0
  30. package/cjs/series-v2-24855152.js +1 -0
  31. package/cjs/series-v2-70137d8c.js +1 -0
  32. package/cjs/settings-icon-a63f46fc.js +1 -0
  33. package/cjs/settings-icon-e6a8feee.js +1 -0
  34. package/cjs/skin-225252ff.js +1 -0
  35. package/cjs/skin-39ab30e2.js +1 -0
  36. package/cjs/skin-83edff36.js +1 -0
  37. package/cjs/skin-84083352.js +1 -0
  38. package/cjs/skin-93a3e5ae.js +1 -0
  39. package/cjs/skin-983a2ea7.js +1 -0
  40. package/cjs/skin-afbec6d7.js +1 -0
  41. package/cjs/skin-ec49b877.js +1 -0
  42. package/cjs/skin-f225a42e.js +1 -0
  43. package/cjs/skin-fb394911.js +1 -0
  44. package/cjs/util-fa21734a.js +1 -0
  45. package/cjs/videoSelector-01a9ef43.js +1 -0
  46. package/cjs/videoSelector-fcdf11eb.js +1 -0
  47. package/esm/autoNextVideo-1672740e.js +1 -0
  48. package/esm/bundle.css +657 -0
  49. package/esm/caption-settings-2e47813b.js +1 -0
  50. package/esm/caption-settings-3eacf3a0.js +1 -0
  51. package/esm/debugSelection-2601b8b3.js +1 -0
  52. package/esm/dvr_skin-9cc1b144.js +1 -0
  53. package/esm/error-2395864b.js +1 -0
  54. package/esm/features-f86404ce.js +1 -0
  55. package/esm/generic-7c43020f.js +1 -0
  56. package/esm/icons-c18c70b7.js +1 -0
  57. package/esm/index-9f022e82.js +1 -0
  58. package/esm/index.js +1 -0
  59. package/esm/keyboardShortcuts-c06f3c7b.js +1 -0
  60. package/esm/loader-580278fe.js +1 -0
  61. package/esm/multicam-94da3759.js +1 -0
  62. package/esm/multicam-de741974.js +1 -0
  63. package/esm/multicamv2-0105c40f.js +1 -0
  64. package/esm/multicamv2-d006cffa.js +1 -0
  65. package/esm/mwebPotrait-3c1805d8.js +1 -0
  66. package/esm/mwebPotraitTray-5ab39989.js +1 -0
  67. package/esm/nextEpisodeButton-2ea69b56.js +1 -0
  68. package/esm/nextEpisodeButton-a1556cdf.js +1 -0
  69. package/esm/nondvr_skin-64be70e5.js +1 -0
  70. package/esm/playlist-032fbbf3.js +1 -0
  71. package/esm/playlist-7ecf432a.js +1 -0
  72. package/esm/renditions-97276745.js +1 -0
  73. package/esm/resolution-38cd4f5c.js +1 -0
  74. package/esm/series-041152aa.js +1 -0
  75. package/esm/series-977edced.js +1 -0
  76. package/esm/series-v2-0727ee8c.js +1 -0
  77. package/esm/series-v2-516c91c2.js +1 -0
  78. package/esm/settings-icon-0125bffd.js +1 -0
  79. package/esm/settings-icon-2b713fbf.js +1 -0
  80. package/esm/skin-2c638dc1.js +1 -0
  81. package/esm/skin-42c2f81d.js +1 -0
  82. package/esm/skin-5e2fa9d4.js +1 -0
  83. package/esm/skin-6093bfb3.js +1 -0
  84. package/esm/skin-665ec17e.js +1 -0
  85. package/esm/skin-93e320fc.js +1 -0
  86. package/esm/skin-b939c35e.js +1 -0
  87. package/esm/skin-cd537931.js +1 -0
  88. package/esm/skin-d5510f70.js +1 -0
  89. package/esm/skin-d6b00653.js +1 -0
  90. package/esm/util-d9f5a7be.js +1 -0
  91. package/esm/videoSelector-8889c58e.js +1 -0
  92. package/esm/videoSelector-8e258d45.js +1 -0
  93. package/package.json +15 -30
  94. package/.babelrc +0 -8
  95. package/.browserslistrc +0 -2
  96. package/README.md +0 -29
  97. package/babel.config.json +0 -8
  98. package/dist/index.cjs.js +0 -1
  99. package/dist/index.d.ts +0 -58
  100. package/dist/index.esm.js +0 -1
  101. package/dist/utility.d.ts +0 -6
  102. package/rollup.config.mjs +0 -31
  103. package/src/index.ts +0 -261
  104. package/src/utility.ts +0 -109
  105. package/tsconfig.json +0 -13
@@ -0,0 +1 @@
1
+ var n=".video-js .vjs-custom-control-spacer {\n display: block;\n flex: 1 1 auto;\n}\n\n.video-js .vjs-play-progress {\n background-color: #CF0A2C !important;\n}\n\n.video-js .vjs-progress-control {\n position: absolute;\n width: 100%;\n height: 0.5em;\n top: -0.5em;\n transition: height .1s, top .1s;\n}\n\n.video-js .vjs-progress-control .vjs-progress-holder {\n margin: 0 7px;\n border-radius: 4px;\n height: 5px;\n}\n\n.video-js .vjs-play-progress:before {\n font-size: 1.2em;\n position: absolute;\n right: -0.5em;\n top: -0.3333333333em;\n}\n\n.video-js .vjs-current-time.vjs-time-control.vjs-control {\n padding-right: 0;\n}\n\n.video-js .vjs-duration.vjs-time-control.vjs-control {\n padding-left: 0;\n}\n\n.video-js .vjs-time-control.vjs-time-divider {\n padding-left: 0;\n padding-right: 0;\n display: flex;\n justify-content: center;\n width: min-content;\n}\n\n.video-js .vjs-time-control {\n display: flex;\n align-items: center;\n font-weight: 900;\n}\n\n.video-js .vjs-remaining-time {\n display: none;\n}\n\n.video-js .vjs-button>.vjs-icon-placeholder:before {\n font-size: 2.1em;\n line-height: 1.67;\n}\n\n.vjs-fullscreen .icon-maximize,\n.icon-minimize {\n display: none;\n height: 28px;\n}\n\n.vjs-fullscreen .icon-minimize,\n.icon-maximize {\n display: block;\n height: 28px;\n}\n\n.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,\n.vjs-icon-fullscreen-enter:before {\n content: '' !important;\n}\n\n.video-js .vjs-control-bar {\n width: 100%;\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 3.5em;\n background-color: #2b333f;\n background-color: rgba(43, 51, 63, .7);\n}\n\n.video-js button.vjs-fullscreen-control.vjs-control.vjs-button {\n display: flex;\n justify-content: center;\n align-items: center;\n transform: rotate(90deg);\n}\n\n.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before {\n display: none;\n}\n\n.video-js .rewindbtn {\n width: 16px !important;\n}\n\n.video-js .skipbtn {\n width: 16px !important;\n}\n\n.video-js button.vjs-subs-caps-button.vjs-menu-button.vjs-menu-button-popup.vjs-button {\n display: flex;\n justify-content: center;\n align-items: center;\n outline: none;\n}\n\n.video-js .vjs-big-play-button {\n font-size: 6em;\n line-height: 1.3em;\n}\n\n.video-js.vjs-paused .vjs-big-play-button{\n width: 90px;\n height: 90px;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom:0;\n margin: auto;\n}\n\n.vjs-play-control.vjs-control.vjs-button:focus{\n outline: none;\n} \n\n.video-js.vjs-waiting .vjs-big-play-button{\n display: none;\n}\n\n.vjs-rewind-button{\n cursor: pointer;\n}\n\n.vjs-skip-button{\n cursor: pointer;\n}\n\n.video-js .vjs-live-display {\n background-color: red;\n padding: 0 5px;\n height: 20px;\n top: 5px;\n position: relative;\n}\n\n.video-js .vjs-live-control {\n line-height: 2em;\n}\n\n.vjs-live-control.vjs-control{\n margin-left: 0.8rem;\n padding-top: 2px;\n}\n\n@media (max-width:600px) {\n .vjs-live-control.vjs-control{\n margin-top: 3px !important;\n }\n\n .video-js .vjs-play-progress:before{\n font-size: 1em !important;\n } \n .video-js .vjs-big-play-button {\n font-size: 3.5em !important;\n line-height: 1.3em !important;\n }\n \n .video-js.vjs-paused .vjs-big-play-button{\n width: 50px !important;\n height: 50px !important;\n }\n\n .video-js .vjs-current-time.vjs-time-control.vjs-control {\n display: none !important;\n }\n\n .video-js .vjs-duration.vjs-time-control.vjs-control {\n display: none !important;\n }\n\n .video-js .vjs-time-control.vjs-time-divider {\n display: none !important;\n }\n\n .video-js .vjs-skip-button {\n display: none !important;\n }\n\n .video-js .vjs-progress-control.vjs-control {\n position: absolute;\n bottom: 1.8rem;\n width: 100;\n height: 1rem;\n }\n\n .video-js .vjs-remaining-time.vjs-time-control.vjs-control {\n position: absolute;\n bottom: 1rem;\n right: 0.2rem;\n font-size: 9px;\n }\n\n .video-js .vjs-custom-control-spacer {\n display: block;\n flex: 1 1 auto;\n }\n\n .video-js .container {\n display: none !important;\n }\n\n .video-js .vjs-control-bar {\n font-size: 12px;\n }\n\n .video-js .vjs-playback-rate.vjs-menu-button.vjs-menu-button-popup.vjs-control.vjs-button {\n display: none;\n }\n\n .video-js button.vjs-picture-in-picture-control.vjs-control.vjs-button {\n display: none;\n }\n\n .video-js .vjs-progress-control.vjs-control:focus {\n outline: none;\n }\n\n .video-js .vjs-slider:focus {\n outline: none;\n }\n\n .video-js .rewindbtn {\n width: 16px;\n }\n\n .video-js .skipbtn {\n width: 16px;\n }\n\n .video-js button.vjs-mute-control.vjs-control.vjs-button.vjs-vol-3 {\n font-size: 11px;\n margin-top: 1px;\n }\n\n .video-js button.vjs-mute-control.vjs-control.vjs-button.vjs-vol-0 {\n font-size: 11px;\n margin-top: 1px;\n }\n}";export{n as default};
@@ -0,0 +1 @@
1
+ var a="";export{a as default};
@@ -0,0 +1 @@
1
+ import{i as e,j as t,k as n,g as i,h as l,d as o,l as a,m as d,n as s,o as r,p as u}from"./features-f86404ce.js";import{M as v,a as c,c as m,d as p}from"./icons-c18c70b7.js";import{G as g,g as f,H as h,v as b}from"./generic-7c43020f.js";import{c as y}from"./skin-665ec17e.js";import{g as C}from"./renditions-97276745.js";import w from"@babel/runtime/helpers/toConsumableArray";import{s as E}from"./autoNextVideo-1672740e.js";import"@babel/runtime/helpers/defineProperty";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";import"@babel/runtime/helpers/inherits";import"@babel/runtime/helpers/possibleConstructorReturn";import"@babel/runtime/helpers/getPrototypeOf";import"video.js";import"axios";import"js-cookie";import"ua-parser-js";import"./util-d9f5a7be.js";var x=g(),N=[];null==x||x.map((function(e){return N.push.apply(N,w(e.episodes))}));var j,B,T,H=function(e,t){var n;null==t||null===(n=t.series)||void 0===n||n.cb;var i=f(e);i.on("timeupdate",(function(){var e,t=Math.floor(i.currentTime()),n=i.duration(),l=null===(e=document.getElementsByClassName("next-ep-preview"))||void 0===e?void 0:e[0];n-t<=10&&h()<=(null==N?void 0:N.length)-1?l&&(l.style.visibility="visible"):l&&(l.style.visibility="hidden")}));var l,o=N.filter((function(e,t){return t==h()}));if((null==o?void 0:o.length)>0)if(null!==(l=document.getElementsByClassName("next-ep-preview"))&&void 0!==l&&l[0]){var a,d,s,r,u,v,c,m,p,g,b;(null===(a=document.getElementsByClassName("next-ep-preview"))||void 0===a?void 0:a[0]).style.visibility="hidden";var y=null===(d=document.getElementsByClassName("next-ep-title"))||void 0===d?void 0:d[0],C=null===(s=document.getElementsByClassName("next-ep-img"))||void 0===s?void 0:s[0],w=null===(r=document.getElementsByClassName("next-ep-content"))||void 0===r?void 0:r[0],E=null===(u=o[0])||void 0===u?void 0:u.title;(null===(v=E)||void 0===v?void 0:v.length)>60&&(E=E.substr(0,60)+"..."),y.innerHTML="".concat(E),C.src=(null===(c=o[0])||void 0===c||null===(m=c.gist)||void 0===m||null===(p=m.imageGist)||void 0===p?void 0:p.r16x9)||(null===(g=window)||void 0===g||null===(b=g.customData)||void 0===b?void 0:b.fallbackImage),w.onclick=function(){return M(e)}}else{var x,j,B,T,H,k,L,V=document.createElement("div");V.className="next-ep-preview",V.style.visibility="hidden",document.getElementById(e).append(V);var D=document.createElement("div");D.className="next-ep-header",D.innerHTML="Next up";var F=null===(x=o[0])||void 0===x?void 0:x.title,I=document.createElement("img");I.className="next-ep-img",I.src=(null===(j=o[0])||void 0===j||null===(B=j.gist)||void 0===B||null===(T=B.imageGist)||void 0===T?void 0:T.r16x9)||(null===(H=window)||void 0===H||null===(k=H.customData)||void 0===k?void 0:k.fallbackImage);var P=document.createElement("div");P.className="next-ep-title",(null===(L=F)||void 0===L?void 0:L.length)>60&&(F=F.substr(0,60)+"..."),P.innerHTML="".concat(F);var S=document.createElement("div");S.className="next-ep-content",S.append(I),S.append(P),S.onclick=function(){return M(e)},V.append(D),V.append(S)}},M=function(e,t){var n=f(e),i=Math.floor(n.currentTime());if(Math.floor(n.duration())!=i){n.pause(e);var l=h();E(l,e,N,sessionStorage.getItem("token"))}},k=function(e){var t=e/T,n=document.getElementsByClassName("bandwidth-container");null!=n&&n.length&&(n[0].innerHTML='<div class="debug-item"><div class="debug-title-item">Connecton Speed </div><div class="debug-value-item">'.concat((t/125).toFixed(2)," kbps</div></div>"),j=(new Date).getTime())},L=function(e){var t=f(e);B=(new Date).getTime(),T=(B-j)/1e3;var n,i,l=t.src();n=l,(i=new XMLHttpRequest).open("HEAD",n,!0),i.onreadystatechange=function(){if(4==i.readyState&&(200==i.status||206==i.status)){var e=i.getResponseHeader("Content-Length");k(e)}},i.send(null)};function V(e){for(var t=f(e),n=t.buffered(),i=t.currentTime(),l=0,o=0;o<n.length;o++)n.start(o)<=i&&n.end(o)>l&&(l=n.end(o));var a=l-i,d=document.getElementsByClassName("buffer-container");d.length&&(d[0].innerHTML='<div class="debug-item"><div class="debug-title-item">Buffer Health </div><div class="debug-value-item">'.concat(a.toFixed(2)," seconds</div></div>"))}var D=function(e){var t=document.getElementsByClassName("debug-container");if(null!=t&&t.length){var n=t[0].getElementsByClassName("volume-container");n.length&&(n[0].innerHTML='<div class="debug-item"><div class="debug-title-item">Volume </div><div class="debug-value-item">'.concat(e,"%</div></div>"))}},F=function(e){f(e).on("loadstart",(function(){j=(new Date).getTime()}))};function I(i,l){var o=f(i);o.on("loadeddata",(function(){var n,a,d;(null===(n=C(i))||void 0===n?void 0:n.length)>0&&e(i,l),(null===(a=b(i))||void 0===a?void 0:a.length)>0&&t(i,l),null!=l&&null!==(d=l.series)&&void 0!==d&&d.enable&&H(i,l),function(e){var t,n=Math.floor(e/60),i=null===(t=document.getElementsByClassName("vjs-progress-holder vjs-slider vjs-slider-horizontal"))||void 0===t?void 0:t[0];i&&(i.style.marginRight=n>60?"56px":"41px")}(o.duration())})),o.one("play",(function(){var e,t,l,o;null!==(e=window)&&void 0!==e&&null!==(t=e.customData)&&void 0!==t&&t.iframeOverlayUrl&&n(i,null===(l=window)||void 0===l||null===(o=l.customData)||void 0===o?void 0:o.iframeOverlayUrl)})),o.on("loadeddata",(function(){!function(e){var t=f(e),n=t.el().clientWidth,i=t.el().clientHeight,l=document.getElementsByClassName("viewport-container");l.length&&(l[0].innerHTML='<div class="debug-item"><div class="debug-title-item">Viewport </div><div class="debug-value-item">'.concat(n,"x").concat(i,"</div></div>"))}(i),L(i)})),o.on("timeupdate",(function(){L(i),V(i),function(e){var t=f(e),n=(null==t?void 0:t.el().querySelector("video")).getVideoPlaybackQuality(),i=n?n.droppedVideoFrames/t.duration():"Unknown",l=document.getElementsByClassName("drop-frames-container");null!=l&&l.length&&(l[0].innerHTML='<div class="debug-item"><div class="debug-title-item">Dropped FPS </div><div class="debug-value-item">'.concat(parseInt(i),"/s</div></div>"))}(i)})),o.on("waiting",(function(){return V(i)})),o.on("volumechange",(function(){var e=100*o.volume().toFixed(2);D(e)})),F(i)}function P(e,t){import("./skin-93e320fc.js").then((function(e){var t=document.createElement("style");t.id="default_v2",t.append("".concat(e.default)),document.head.appendChild(t)})),I(e,t),function(e,t){var n=f(e);n.controlBar.getChild("FullscreenToggle").el().appendChild(y(v(window.controlsColor))),n.controlBar.getChild("FullscreenToggle").el().appendChild(y(c(window.controlsColor)));var i=document.getElementsByClassName("vjs-time-control");t.liveVideo&&(i[0].style.display="none")}(e,t),function(e,t){var n,v,c,g,f,h;0==(null==t?void 0:t.liveVideo)&&0==(null==t?void 0:t.liveui)&&i(e,"defaultV2",m());(0==(null==t?void 0:t.liveVideo)&&0==(null==t?void 0:t.liveui)||1==(null==t?void 0:t.liveui))&&l(e,"defaultV2",p());t.liveVideo||o(e);(null==t||null===(n=t.relatedVideos)||void 0===n||null===(v=n.content)||void 0===v?void 0:v.length)>0&&a(e,null==t?void 0:t.relatedVideos);(null==t||null===(c=t.streams)||void 0===c?void 0:c.length)>1&&d(e,null==t?void 0:t.streams);(null==t||null===(g=t.playlist)||void 0===g||null===(f=g.content)||void 0===f?void 0:f.length)>0&&s(e,null==t?void 0:t.playlist);null!=t&&null!==(h=t.series)&&void 0!==h&&h.enable&&r(e,t);null!=t&&t.debugStats&&u(e,t)}(e,t),function(e,t){var n=f(e),i=null==t?void 0:t.tvProviderLogoUrl;if(!i)return;var l=document.createElement("div");l.className="tvProviderImage";var o=document.createElement("img");o.src="".concat(i),o.alt="Provider Image",l.append(o),n.el().appendChild(l),n.on("useractive",(function(){l.classList.remove("vjs-fade")})),n.on("userinactive",(function(){n.paused()||l.classList.add("vjs-fade")})),n.on("fullscreenchange",(function(){n.isFullscreen_?l.style.top="3.2rem":l.style.top="1rem"}))}(e,t)}export{P as initialiseSkin};
@@ -0,0 +1 @@
1
+ import{g as t}from"./generic-7c43020f.js";var n=function(n,a,r){var e=t(n);e?a>=0&&a<=e.duration()?(r({status:!0,msg:"Successfully seeked to timestamp : ".concat(a)}),e.currentTime(a)):r({status:!1,msg:"Out of bounds, please provide a valid timestamp"}):r("Cannot find player with id: '".concat(n,"'"))},a=function(n,a){var r=t(n);if(!r)return"Cannot find player with id: '".concat(n,"'");try{return r.playbackRate(a),"Playback speed set to ".concat(a,"x")}catch(t){return"Error: ".concat(t)}},r=function(n,a){var r=t(n);r?r.on("timeupdate",(function(){return a(r.currentTime())})):a("Cannot find player with id: '".concat(n,"'"))},e=function(n,a){var r=t(n);r?r.on("ended",(function(){return a(!0)})):a("Cannot find player with id: '".concat(n,"'"))},i=function(n){var a=t(n);return a?a.duration():"Cannot find player with id: '".concat(n,"'")};export{e as a,a as b,i as g,r as o,n as s};
@@ -0,0 +1 @@
1
+ import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/inherits";import n from"@babel/runtime/helpers/possibleConstructorReturn";import i from"@babel/runtime/helpers/getPrototypeOf";import a from"video.js";import{E as r,e as l}from"./icons-c18c70b7.js";import{g as c,o as s,J as d}from"./generic-7c43020f.js";import{a as m,h as u}from"./skin-665ec17e.js";import{a as p}from"./autoNextVideo-1672740e.js";import"@babel/runtime/helpers/defineProperty";import"axios";import"js-cookie";import"ua-parser-js";import"@babel/runtime/helpers/toConsumableArray";import"./util-d9f5a7be.js";function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var o,a=i(e);if(t){var r=i(this).constructor;o=Reflect.construct(a,arguments,r)}else o=a.apply(this,arguments);return n(this,o)}}var h=a.getComponent("Component"),f=function(n){o(f,h);var i=v(f);function f(t){var o,n,a,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e(this,f),(a=i.call(this,t,r)).playerId=r.playerId,a.seriesData=r.sres,a.videos=r.related.content,a.cb=(null==r||null===(o=r.related)||void 0===o?void 0:o.cb)||null,a.autoNext=(null==r||null===(n=r.related)||void 0===n?void 0:n.autoNext)||!1,a.currentVideoData=r.res,a.initialiseStructure(),a.loadCSS(),a.autoNext&&p({playerId:a.playerId,content:a.videos,cb:a.cb}),a}return t(f,[{key:"createEl",value:function(){var e=a.dom.createEl("div",{className:"video-selection vjs-control vjs-button"});e.style.position="unset";var t=a.dom.createEl("div",{className:"video-selector-icon",innerHTML:"".concat(r())});return a.dom.appendContent(e,t),e}},{key:"loadCSS",value:function(){import("./videoSelector-8e258d45.js").then((function(e){var t=document.createElement("style");t.id="video-selection",t.append("".concat(e.default)),document.head.appendChild(t)}))}},{key:"initialiseStructure",value:function(){var e=this.el(),t=a.dom.createEl("div",{className:"video-selection-container hidden"});a.dom.$(".video-selector-icon",this.el()).onclick=function(){var o;null!==(o=t.classList)&&void 0!==o&&o.contains("hidden")?(m(),t.classList.remove("hidden"),e.classList.add("open"),t.style.right="0px"):(t.classList.add("hidden"),e.classList.remove("open"),t.style.right="-350px")};var o=window.getComputedStyle(document.getElementById(this.playerId),null).getPropertyValue("height").slice(0,-2);t.style.height="".concat(o,"px"),a.dom.appendContent(e,t),document.getElementById(this.playerId).style.overflow="hidden",this.addFunctionality(t)}},{key:"toggleOpenClose",value:function(){}},{key:"addFunctionality",value:function(e){var t=this,o=this.el(),n=a.dom.createEl("div",{className:"video-selector-head"}),i=a.dom.createEl("div",{className:"video-selector-cross-icon",innerHTML:"".concat(l())});i.onclick=function(){e.classList.add("hidden"),o.classList.remove("open"),e.style.right="-350px"};for(var r=a.dom.createEl("div",{className:"video-selector-title",innerHTML:"Recommended"}),m=a.dom.createEl("div",{className:"video-selector-content"}),p=a.dom.createEl("div",{className:"video-container"}),v=function(e){var o,n=a.dom.createEl("div",{className:"video -".concat(e)}),i=a.dom.createEl("div",{className:"recommended -".concat(e)});i.setAttribute("video-idx",e),i.onclick=function(){d(e+1);for(var o=a.dom.$$(".recommended"),n=0;n<o.length;n++)o[n].style.border="none";u(e),s(t.playerId,t.videos[e].id,sessionStorage.getItem("token")).then((function(e){t.cb&&t.cb(e)})).catch((function(e){t.cb&&t.cb(e)}))};var r=document.createElement("img");r.className="related-thumbnail-image",r.src="".concat(t.videos[e].img),r.alt="No Thumbnail Available",i.append(r);var l=a.dom.createEl("div",{className:"info -".concat(e),innerHTML:"".concat((null==t||null===(o=t.videos[e])||void 0===o?void 0:o.title)||"")});a.dom.appendContent(n,i),a.dom.appendContent(n,l),a.dom.appendContent(p,n),a.dom.appendContent(m,p)},h=0;h<this.videos.length;h++)v(h);a.dom.appendContent(n,i),a.dom.appendContent(n,r),a.dom.appendContent(e,n),a.dom.appendContent(e,m),c(this.playerId).on("fullscreenchange",(function(){var o=window.getComputedStyle(document.getElementById(t.playerId),null).getPropertyValue("height").slice(0,-2);e.style.height="".concat(o,"px")}))}}]),f}();export{f as default};
@@ -0,0 +1 @@
1
+ var n=".video-selection {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.video-selector-icon {\n cursor: pointer;\n}\n\n.video-selection-container {\n position: absolute;\n width: 350px;\n bottom: 0px;\n right: -350px;\n background: #00000080 !important;\n z-index: -1;\n transition: right 300ms ease-out;\n}\n\n.video-container {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n}\n\n.video-selection.open {\n background: rgba(255, 255, 255, 0.20) !important;\n}\n\n.video-selector-head {\n display: flex;\n align-items: center;\n padding-top: 18px;\n padding-left: 20px;\n margin-bottom: 20px;\n}\n\n.video-selector-title {\n font-size: 18px;\n font-weight: 600;\n margin-left: 25px;\n user-select: none;\n}\n\n.video-selector-cross-icon {\n cursor: pointer;\n}\n\n.video-selector-content {\n height: 74%;\n overflow: scroll;\n}\n\n.video-selector-content::-webkit-scrollbar {\n display: none;\n}\n\n/* Hide scrollbar for IE, Edge and Firefox */\n.video-selector-content {\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */\n}\n\n.video-selector-content-video {\n height: 300px;\n margin-bottom: 30px;\n}\n\n.recommended {\n height: 175px;\n width: 309px;\n background-repeat: no-repeat;\n background-size: contain;\n}\n.related-thumbnail-image{\n width: 100%;\n height: 100%;\n}\n.video {\n display: flex;\n flex-direction: column;\n align-items: center;\n margin-bottom: 12px;\n}\n\n.parent {\n margin: 21px 52px 23px 34px;\n\n}\n\n.recommended:hover {\n cursor: pointer;\n}\n\n.info {\n font-size: 13px;\n padding: 7px 22px;\n}\n\n@media (max-width:600px){\n .video-selector-cross-icon>svg{\n height: 12px;\n }\n .video-selector-title{\n font-size: 14px;\n }\n .video-selector-content{\n height: 52%;\n }\n .video-selection-container{\n width: 200px;\n }\n .recommended{\n height: 90px !important;\n width: 154px !important;\n }\n .info {\n font-size: 9px !important;\n }\n .video-selector-title{\n margin-left: 13px;\n }\n}";export{n as default};
package/package.json CHANGED
@@ -1,32 +1,17 @@
1
1
  {
2
- "name": "@viewlift/player-backup",
3
- "version": "1.0.0-lighteningjs",
4
- "description": "A LightningJS video player component for Smart TV apps.",
5
- "main": "dist/index.cjs.js",
6
- "module": "dist/index.esm.js",
7
- "types": "dist/index.d.ts",
8
- "scripts": {
9
- "build": "rollup -c",
10
- "dev": "rollup -c -w",
11
- "test": "echo \"No tests specified\" && exit 0"
12
- },
13
- "author": "ViewLift",
14
- "license": "ISC",
15
- "keywords": [
16
- "LightningJS",
17
- "SmartTV",
18
- "video-player"
19
- ],
20
- "devDependencies": {
21
- "@babel/core": "^7.24.4",
22
- "@babel/preset-env": "^7.24.4",
23
- "@rollup/plugin-babel": "^6.0.4",
24
- "@rollup/plugin-commonjs": "^25.0.7",
25
- "@rollup/plugin-node-resolve": "^15.0.2",
26
- "@rollup/plugin-terser": "^0.4.4",
27
- "@rollup/plugin-typescript": "^11.1.6",
28
- "rollup": "^4.16.4",
29
- "tslib": "^2.6.2",
30
- "typescript": "^5.4.5"
31
- }
2
+ "name": "@viewlift/player-backup",
3
+ "version": "1.0.0",
4
+ "main": "dist/bundle.cjs.js",
5
+ "amdName": "_playerCore",
6
+ "dependencies": {
7
+ "@silvermine/videojs-airplay": "^1.2.0",
8
+ "@silvermine/videojs-chromecast": "^1.4.1",
9
+ "axios": "^1.2.3",
10
+ "js-cookie": "^3.0.5",
11
+ "video.js": "^7.20.3",
12
+ "videojs-contrib-ads": "^6.9.0",
13
+ "videojs-contrib-dash": "^5.1.1",
14
+ "videojs-contrib-eme": "^3.11.0",
15
+ "videojs-ima": "^2.1.0"
16
+ }
32
17
  }
package/.babelrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "presets": [
3
- ["@babel/preset-env", {
4
- "targets": { "ie": "11" },
5
- "modules": false
6
- }]
7
- ]
8
- }
package/.browserslistrc DELETED
@@ -1,2 +0,0 @@
1
- IE 11
2
- last 2 versions
package/README.md DELETED
@@ -1,29 +0,0 @@
1
- # @viewlift/ligheningjs-video-player
2
-
3
- A LightningJS video player component for Smart TV app development.
4
-
5
- ## Features
6
- - Video player component for LightningJS
7
- - TypeScript support
8
- - Easy to use in LightningJS-based projects
9
-
10
- ## Installation
11
- ```bash
12
- npm install @viewlift/ligheningjs-video-player
13
- ```
14
-
15
- ## Usage
16
- ```ts
17
- import { LightningVideoPlayer } from '@viewlift/ligheningjs-video-player';
18
-
19
- const player = new LightningVideoPlayer();
20
- player.play();
21
- ```
22
-
23
- ## Build
24
- ```bash
25
- npm run build
26
- ```
27
-
28
- ## License
29
- ISC
package/babel.config.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "presets": [
3
- ["@babel/preset-env", {
4
- "targets": { "ie": "11" },
5
- "modules": false
6
- }]
7
- ]
8
- }
package/dist/index.cjs.js DELETED
@@ -1 +0,0 @@
1
- "use strict";require("@viewlift/player-backup/esm/bundle.css");var t,e=function(t){return"lgTv"==t?"lg":"vizioTv"==t?"vizio":"xfinityX1"==t?"xfinityX1":"xbox"==t?"xBox":"samsung"};!function(t){t.LG="lgTv",t.Vizio="vizioTv",t.XfinityX1="xfinityX1",t.Xbox="xbox",t.Samsung="samsungTv"}(t||(t={}));var n=function(){function t(t){var e=this;this.listeners={},this.boundEmitters={},this.boundHandlerMap={},this.options=t,this.videoElement=document.createElement("video"),this.videoElement.id=t.playerId,this.videoElement.autoplay=!!t.autoplay,t.width&&(this.videoElement.width=t.width),t.height&&(this.videoElement.height=t.height),this.videoElement.style.display="block",this.videoElement.style.background="black";var n={play:this.onPlay,pause:this.onPause,ended:this.onEnded,timeupdate:this.onTimeupdate,error:this.onError,loadedmetadata:this.onLoadedmetadata,seeking:this.onSeeking,seeked:this.onSeeked,volumechange:this.onVolumechange};Object.keys(n).forEach(function(t){var i=n[t].bind(e);e.boundHandlerMap[t]=i,e.videoElement.addEventListener(t,i)})}return t.prototype.initialize=function(){return window.appMainConfig.apiBaseUrl,this.options.playerId,this.options.contentId,this.options.authToken,this.options.autoplay,this.options.profileId,this.options.deviceName,e(this.options.deviceName),window.appSettings.device,window.appMainConfig.internalName,!0},t.prototype.attachTo=function(t){t.appendChild(this.videoElement)},t.prototype.play=function(){this.videoElement.play()},t.prototype.pause=function(){this.videoElement.pause()},t.prototype.stop=function(){this.videoElement.pause(),this.videoElement.currentTime=0},t.prototype.destroy=function(){var t=this;this.videoElement.parentNode&&this.videoElement.parentNode.removeChild(this.videoElement),this.removeAllListeners(),Object.keys(this.boundHandlerMap).forEach(function(e){t.boundHandlerMap[e]&&(t.videoElement.removeEventListener(e,t.boundHandlerMap[e]),delete t.boundHandlerMap[e])})},Object.defineProperty(t.prototype,"element",{get:function(){return this.videoElement},enumerable:!1,configurable:!0}),t.prototype.onPlay=function(t){"function"==typeof this.options.onPlaybackSuccess&&this.options.onPlaybackSuccess()},t.prototype.onPause=function(t){},t.prototype.onEnded=function(t){"function"==typeof this.options.onPlaybackEnded&&this.options.onPlaybackEnded()},t.prototype.onTimeupdate=function(t){},t.prototype.onError=function(t){"function"==typeof this.options.onPlaybackError&&this.options.onPlaybackError(t)},t.prototype.onLoadedmetadata=function(t){},t.prototype.onSeeking=function(t){},t.prototype.onSeeked=function(t){},t.prototype.onVolumechange=function(t){},t.prototype.on=function(t,e){this.listeners[t]||(this.listeners[t]=[],this.boundEmitters[t]||(this.boundEmitters[t]=this.emitEvent(t),this.videoElement.addEventListener(t,this.boundEmitters[t]))),this.listeners[t].push(e)},t.prototype.off=function(t,e){this.listeners[t]&&(this.listeners[t]=this.listeners[t].filter(function(t){return t!==e}),0===this.listeners[t].length&&(this.boundEmitters[t]&&(this.videoElement.removeEventListener(t,this.boundEmitters[t]),delete this.boundEmitters[t]),delete this.listeners[t]))},t.prototype.once=function(t,e){var n=this,i=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];e.apply(void 0,o),n.off(t,i)};this.on(t,i)},t.prototype.emitEvent=function(t){var e=this;return function(n){e.listeners[t]&&e.listeners[t].forEach(function(t){return t(n)})}},t.prototype.removeAllListeners=function(){var t=this;Object.keys(this.listeners).forEach(function(e){t.boundEmitters[e]&&(t.videoElement.removeEventListener(e,t.boundEmitters[e]),delete t.boundEmitters[e])}),this.listeners={}},t}();exports.LightningVideoPlayer=n;
package/dist/index.d.ts DELETED
@@ -1,58 +0,0 @@
1
- import '@viewlift/player-backup/esm/bundle.css';
2
- export interface VideoPlayerOptions {
3
- onPlaybackSuccess?: () => void;
4
- onPlaybackEnded?: () => void;
5
- onPlaybackError?: (error?: any) => void;
6
- playerId: string;
7
- contentId: string;
8
- profileId: string;
9
- deviceId: string;
10
- authToken: string;
11
- autoplay?: boolean;
12
- controls?: boolean;
13
- width?: number;
14
- height?: number;
15
- deviceName: DeviceType;
16
- }
17
- declare enum DeviceType {
18
- LG = "lgTv",
19
- Vizio = "vizioTv",
20
- XfinityX1 = "xfinityX1",
21
- Xbox = "xbox",
22
- Samsung = "samsungTv"
23
- }
24
- type EventHandler = (...args: any[]) => void;
25
- type VideoPlayerEvent = 'play' | 'pause' | 'ended' | 'timeupdate' | 'error' | 'loadedmetadata' | 'seeking' | 'seeked' | 'volumechange';
26
- export declare class LightningVideoPlayer {
27
- /**
28
- * Reinitialize the current videoElement with a new set of options and handle autoplay.
29
- */
30
- private videoElement;
31
- private options;
32
- private listeners;
33
- private boundEmitters;
34
- private boundHandlerMap;
35
- constructor(options: VideoPlayerOptions);
36
- initialize(): boolean;
37
- attachTo(container: HTMLElement): void;
38
- play(): void;
39
- pause(): void;
40
- stop(): void;
41
- destroy(): void;
42
- get element(): HTMLVideoElement;
43
- onPlay(e: Event): void;
44
- onPause(e: Event): void;
45
- onEnded(e: Event): void;
46
- onTimeupdate(e: Event): void;
47
- onError(e: Event): void;
48
- onLoadedmetadata(e: Event): void;
49
- onSeeking(e: Event): void;
50
- onSeeked(e: Event): void;
51
- onVolumechange(e: Event): void;
52
- on(event: VideoPlayerEvent, handler: EventHandler): void;
53
- off(event: VideoPlayerEvent, handler: EventHandler): void;
54
- once(event: VideoPlayerEvent, handler: EventHandler): void;
55
- private emitEvent;
56
- private removeAllListeners;
57
- }
58
- export {};
package/dist/index.esm.js DELETED
@@ -1 +0,0 @@
1
- import"@viewlift/player-backup/esm/bundle.css";var t,e=function(t){return"lgTv"==t?"lg":"vizioTv"==t?"vizio":"xfinityX1"==t?"xfinityX1":"xbox"==t?"xBox":"samsung"};!function(t){t.LG="lgTv",t.Vizio="vizioTv",t.XfinityX1="xfinityX1",t.Xbox="xbox",t.Samsung="samsungTv"}(t||(t={}));var n=function(){function t(t){var e=this;this.listeners={},this.boundEmitters={},this.boundHandlerMap={},this.options=t,this.videoElement=document.createElement("video"),this.videoElement.id=t.playerId,this.videoElement.autoplay=!!t.autoplay,t.width&&(this.videoElement.width=t.width),t.height&&(this.videoElement.height=t.height),this.videoElement.style.display="block",this.videoElement.style.background="black";var n={play:this.onPlay,pause:this.onPause,ended:this.onEnded,timeupdate:this.onTimeupdate,error:this.onError,loadedmetadata:this.onLoadedmetadata,seeking:this.onSeeking,seeked:this.onSeeked,volumechange:this.onVolumechange};Object.keys(n).forEach(function(t){var i=n[t].bind(e);e.boundHandlerMap[t]=i,e.videoElement.addEventListener(t,i)})}return t.prototype.initialize=function(){return window.appMainConfig.apiBaseUrl,this.options.playerId,this.options.contentId,this.options.authToken,this.options.autoplay,this.options.profileId,this.options.deviceName,e(this.options.deviceName),window.appSettings.device,window.appMainConfig.internalName,!0},t.prototype.attachTo=function(t){t.appendChild(this.videoElement)},t.prototype.play=function(){this.videoElement.play()},t.prototype.pause=function(){this.videoElement.pause()},t.prototype.stop=function(){this.videoElement.pause(),this.videoElement.currentTime=0},t.prototype.destroy=function(){var t=this;this.videoElement.parentNode&&this.videoElement.parentNode.removeChild(this.videoElement),this.removeAllListeners(),Object.keys(this.boundHandlerMap).forEach(function(e){t.boundHandlerMap[e]&&(t.videoElement.removeEventListener(e,t.boundHandlerMap[e]),delete t.boundHandlerMap[e])})},Object.defineProperty(t.prototype,"element",{get:function(){return this.videoElement},enumerable:!1,configurable:!0}),t.prototype.onPlay=function(t){"function"==typeof this.options.onPlaybackSuccess&&this.options.onPlaybackSuccess()},t.prototype.onPause=function(t){},t.prototype.onEnded=function(t){"function"==typeof this.options.onPlaybackEnded&&this.options.onPlaybackEnded()},t.prototype.onTimeupdate=function(t){},t.prototype.onError=function(t){"function"==typeof this.options.onPlaybackError&&this.options.onPlaybackError(t)},t.prototype.onLoadedmetadata=function(t){},t.prototype.onSeeking=function(t){},t.prototype.onSeeked=function(t){},t.prototype.onVolumechange=function(t){},t.prototype.on=function(t,e){this.listeners[t]||(this.listeners[t]=[],this.boundEmitters[t]||(this.boundEmitters[t]=this.emitEvent(t),this.videoElement.addEventListener(t,this.boundEmitters[t]))),this.listeners[t].push(e)},t.prototype.off=function(t,e){this.listeners[t]&&(this.listeners[t]=this.listeners[t].filter(function(t){return t!==e}),0===this.listeners[t].length&&(this.boundEmitters[t]&&(this.videoElement.removeEventListener(t,this.boundEmitters[t]),delete this.boundEmitters[t]),delete this.listeners[t]))},t.prototype.once=function(t,e){var n=this,i=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];e.apply(void 0,o),n.off(t,i)};this.on(t,i)},t.prototype.emitEvent=function(t){var e=this;return function(n){e.listeners[t]&&e.listeners[t].forEach(function(t){return t(n)})}},t.prototype.removeAllListeners=function(){var t=this;Object.keys(this.listeners).forEach(function(e){t.boundEmitters[e]&&(t.videoElement.removeEventListener(e,t.boundEmitters[e]),delete t.boundEmitters[e])}),this.listeners={}},t}();export{n as LightningVideoPlayer};
package/dist/utility.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export declare const getDeviceMaker: (deviceName: string) => "LG" | "Vizio" | "xfinityX1" | "Microsoft" | "Samsung";
2
- export declare const getUserAgent: (deviceName: string) => "xfinityX1" | "SmartTV_LG_WebOS" | "SmartTV_Vizio_SmartCast" | "xboxOne" | "SmartTV_Samsung_Tizen";
3
- export declare const getOSName: (deviceName: string) => "xfinityX1" | "WebOS" | "SmartCast" | "Windows" | "Tizen";
4
- export declare const getDeviceShortName: (deviceName: string) => "xfinityX1" | "lg" | "vizio" | "xBox" | "samsung";
5
- export declare const getDeviceFullName: (deviceName: string) => "xfinityX1" | "vizioTv" | "smart_tv_lg" | "windows_xbox" | "smart_tv_samsung";
6
- export declare const getMacros: (width: any, height: any, deviceName: any, deviceId: any) => {};
package/rollup.config.mjs DELETED
@@ -1,31 +0,0 @@
1
- import resolve from '@rollup/plugin-node-resolve';
2
- import commonjs from '@rollup/plugin-commonjs';
3
- import terser from '@rollup/plugin-terser';
4
- import typescript from '@rollup/plugin-typescript';
5
- import babel from '@rollup/plugin-babel';
6
-
7
- export default {
8
- input: 'src/index.ts',
9
- output: [
10
- {
11
- file: 'dist/index.cjs.js',
12
- format: 'cjs',
13
- exports: 'auto',
14
- },
15
- {
16
- file: 'dist/index.esm.js',
17
- format: 'esm',
18
- },
19
- ],
20
- plugins: [
21
- resolve(),
22
- commonjs(),
23
- typescript({ tsconfig: './tsconfig.json' }),
24
- babel({
25
- babelHelpers: 'bundled',
26
- extensions: ['.js', '.ts'],
27
- exclude: 'node_modules/**',
28
- }),
29
- terser(),
30
- ],
31
- };
package/src/index.ts DELETED
@@ -1,261 +0,0 @@
1
- // LightningJS-compatible Video Player Component (ES5 compatible)
2
-
3
- import '@viewlift/player-backup/esm/bundle.css'
4
- import { getDeviceFullName, getDeviceShortName,getMacros } from './utility';
5
- export interface VideoPlayerOptions {
6
- // Optional playback callbacks
7
- onPlaybackSuccess?: () => void;
8
- onPlaybackEnded?: () => void;
9
- onPlaybackError?: (error?: any) => void;
10
- playerId: string;
11
- contentId: string;
12
- profileId: string;
13
- deviceId:string;
14
- authToken: string
15
- autoplay?: boolean;
16
- controls?: boolean;
17
- width?: number;
18
-
19
- height?: number;
20
- deviceName: DeviceType
21
- // Event callbacks
22
- }
23
-
24
- enum DeviceType {
25
- LG = 'lgTv',
26
- Vizio = 'vizioTv',
27
- XfinityX1 = 'xfinityX1',
28
- Xbox = 'xbox',
29
- Samsung = 'samsungTv'
30
- }
31
- type EventHandler = (...args: any[]) => void;
32
-
33
- type VideoPlayerEvent =
34
- | 'play'
35
- | 'pause'
36
- | 'ended'
37
- | 'timeupdate'
38
- | 'error'
39
- | 'loadedmetadata'
40
- | 'seeking'
41
- | 'seeked'
42
- | 'volumechange';
43
-
44
- export class LightningVideoPlayer {
45
- /**
46
- * Reinitialize the current videoElement with a new set of options and handle autoplay.
47
- */
48
-
49
- private videoElement: HTMLVideoElement;
50
- private options: VideoPlayerOptions;
51
- private listeners: { [event: string]: EventHandler[] } = {};
52
- private boundEmitters: { [event: string]: EventListener } = {};
53
- private boundHandlerMap: { [K in VideoPlayerEvent]?: (e: Event) => void } = {};
54
-
55
- constructor(options: VideoPlayerOptions) {
56
- this.options = options;
57
- this.videoElement = document.createElement('video');
58
- this.videoElement.id = options.playerId;
59
- this.videoElement.autoplay = !!options.autoplay;
60
- if (options.width) this.videoElement.width = options.width;
61
- if (options.height) this.videoElement.height = options.height;
62
- this.videoElement.style.display = 'block';
63
- this.videoElement.style.background = 'black';
64
-
65
- // Attach class event handlers for all player events
66
- const handlerMap: { [K in VideoPlayerEvent]: (e: Event) => void } = {
67
- play: this.onPlay,
68
- pause: this.onPause,
69
- ended: this.onEnded,
70
- timeupdate: this.onTimeupdate,
71
- error: this.onError,
72
- loadedmetadata: this.onLoadedmetadata,
73
- seeking: this.onSeeking,
74
- seeked: this.onSeeked,
75
- volumechange: this.onVolumechange,
76
- };
77
- (Object.keys(handlerMap) as VideoPlayerEvent[]).forEach(event => {
78
- const boundHandler = handlerMap[event].bind(this);
79
- this.boundHandlerMap[event] = boundHandler;
80
- this.videoElement.addEventListener(event, boundHandler);
81
- });
82
- }
83
-
84
- initialize() {
85
- let configurationObject = {
86
- apiBaseUrl: (window as any).appMainConfig.apiBaseUrl,
87
- playerId: this.options.playerId,
88
- videoId: this.options.contentId,
89
- token: this.options.authToken,
90
- disableControls: true,
91
- autoplay:this.options.autoplay,
92
- watchHistory:{
93
- enable:false,
94
- interval:30,
95
- profileId:this.options.profileId,
96
- apiVersion:'v2'
97
- },
98
- customData: {
99
- entitlement: {
100
- deviceType: getDeviceFullName(this.options.deviceName),
101
- contentConsumption: getDeviceShortName(this.options.deviceName),
102
- // hba_status: localStorage?.getItem("hba_status")?JSON.stringify(localStorage?.getItem("hba_status")):false,
103
- // householdID: localStorage?.getItem(window?.appMainConfig?.internalName + "_householdID"),
104
- },
105
- beacon: {
106
- params: {
107
- pfm: (window as any).appSettings.device
108
- },
109
- url: (window as any).appMainConfig.internalName,
110
- },
111
- // macros:getMacros(videoPlayBackObject,1920,1080,this.options.deviceName,this.options.deviceId),
112
- overrideNative:true,
113
- nativeAudioTracks:false,
114
- nativeVideoTracks:false,
115
- onlyPlayReadyDRM:true,
116
- }
117
- };
118
- return true
119
- }
120
-
121
- attachTo(container: HTMLElement) {
122
- container.appendChild(this.videoElement);
123
- }
124
-
125
- play() {
126
- this.videoElement.play();
127
- }
128
-
129
- pause() {
130
- this.videoElement.pause();
131
- }
132
-
133
- stop() {
134
- this.videoElement.pause();
135
- this.videoElement.currentTime = 0;
136
- }
137
-
138
- destroy() {
139
- if (this.videoElement.parentNode) {
140
- this.videoElement.parentNode.removeChild(this.videoElement);
141
- }
142
- this.removeAllListeners();
143
- // Remove class event handlers
144
- (Object.keys(this.boundHandlerMap) as VideoPlayerEvent[]).forEach(event => {
145
- if (this.boundHandlerMap[event]) {
146
- this.videoElement.removeEventListener(event, this.boundHandlerMap[event]!);
147
- delete this.boundHandlerMap[event];
148
- }
149
- });
150
- }
151
-
152
- get element(): HTMLVideoElement {
153
- return this.videoElement;
154
- }
155
-
156
- // Event callback function definitions
157
- onPlay(e: Event) {
158
- // Called when playback starts
159
- if (typeof this.options.onPlaybackSuccess === 'function') {
160
- this.options.onPlaybackSuccess();
161
- }
162
- }
163
-
164
- onPause(e: Event) {
165
- // Called when playback is paused
166
- // Override or pass as option
167
- }
168
-
169
- onEnded(e: Event) {
170
- // Called when playback ends
171
- if (typeof this.options.onPlaybackEnded === 'function') {
172
- this.options.onPlaybackEnded();
173
- }
174
- }
175
-
176
- onTimeupdate(e: Event) {
177
- // Called when playback position changes
178
- // Override or pass as option
179
- }
180
-
181
- onError(e: Event) {
182
- // Called on playback error
183
- if (typeof this.options.onPlaybackError === 'function') {
184
- this.options.onPlaybackError(e);
185
- }
186
- }
187
-
188
- onLoadedmetadata(e: Event) {
189
- // Called when metadata is loaded
190
- // Override or pass as option
191
- }
192
-
193
- onSeeking(e: Event) {
194
- // Called when seeking starts
195
- // Override or pass as option
196
- }
197
-
198
- onSeeked(e: Event) {
199
- // Called when seeking ends
200
- // Override or pass as option
201
- }
202
-
203
- onVolumechange(e: Event) {
204
- // Called when volume changes
205
- // Override or pass as option
206
- }
207
-
208
- // Event system
209
- on(event: VideoPlayerEvent, handler: EventHandler) {
210
- if (!this.listeners[event]) {
211
- this.listeners[event] = [];
212
- if (!this.boundEmitters[event]) {
213
- this.boundEmitters[event] = this.emitEvent(event);
214
- this.videoElement.addEventListener(event, this.boundEmitters[event]);
215
- }
216
- }
217
- this.listeners[event].push(handler);
218
- }
219
-
220
- off(event: VideoPlayerEvent, handler: EventHandler) {
221
- if (!this.listeners[event]) return;
222
- this.listeners[event] = this.listeners[event].filter(h => h !== handler);
223
- if (this.listeners[event].length === 0) {
224
- if (this.boundEmitters[event]) {
225
- this.videoElement.removeEventListener(event, this.boundEmitters[event]);
226
- delete this.boundEmitters[event];
227
- }
228
- delete this.listeners[event];
229
- }
230
- }
231
-
232
- once(event: VideoPlayerEvent, handler: EventHandler) {
233
- const onceHandler: EventHandler = (...args) => {
234
- handler(...args);
235
- this.off(event, onceHandler);
236
- };
237
- this.on(event, onceHandler);
238
- }
239
-
240
- private emitEvent(event: VideoPlayerEvent) {
241
- return (e: Event) => {
242
- if (this.listeners[event]) {
243
- this.listeners[event].forEach(handler => handler(e));
244
- }
245
- };
246
- }
247
-
248
- private removeAllListeners() {
249
- (Object.keys(this.listeners) as VideoPlayerEvent[]).forEach(event => {
250
- if (this.boundEmitters[event]) {
251
- this.videoElement.removeEventListener(event, this.boundEmitters[event]);
252
- delete this.boundEmitters[event];
253
- }
254
- });
255
- this.listeners = {};
256
- }
257
- }
258
-
259
- function getHandlerMethodName(event: string): string {
260
- return 'on' + event.charAt(0).toUpperCase() + event.slice(1);
261
- }
package/src/utility.ts DELETED
@@ -1,109 +0,0 @@
1
- export const getDeviceMaker = (deviceName:string) => {
2
- if (deviceName == "lgTv") {
3
- return "LG";
4
- } else if (deviceName == "vizioTv") {
5
- return "Vizio";
6
- } else if(deviceName == "xfinityX1"){
7
- return "xfinityX1"
8
- }else if(deviceName == "xbox"){
9
- return "Microsoft"
10
- }else {
11
- return "Samsung";
12
- }
13
- }
14
-
15
-
16
- export const getUserAgent = (deviceName:string) => {
17
- if (deviceName == "lgTv") {
18
- return "SmartTV_LG_WebOS";
19
- } else if (deviceName == "vizioTv") {
20
- return "SmartTV_Vizio_SmartCast";
21
- } else if(deviceName == "xfinityX1"){
22
- return "xfinityX1"
23
- }else if(deviceName == "xbox"){
24
- return "xboxOne"
25
- }else {
26
- return "SmartTV_Samsung_Tizen";
27
- }
28
- }
29
- export const getOSName = (deviceName:string) => {
30
- if (deviceName == "lgTv") {
31
- return "WebOS";
32
- } else if (deviceName == "vizioTv") {
33
- return "SmartCast";
34
- } else if(deviceName == "xfinityX1"){
35
- return "xfinityX1"
36
- }else if(deviceName == "xbox"){
37
- return "Windows"
38
- }else {
39
- return "Tizen";
40
- }
41
- }
42
- export const getDeviceShortName = (deviceName:string) => {
43
- if (deviceName == "lgTv") {
44
- return "lg";
45
- } else if (deviceName == "vizioTv") {
46
- return "vizio";
47
- } else if(deviceName == "xfinityX1"){
48
- return "xfinityX1"
49
- }else if(deviceName == "xbox"){
50
- return "xBox"
51
- }else {
52
- return "samsung";
53
- }
54
- }
55
- export const getDeviceFullName = (deviceName:string) => {
56
- if (deviceName == "lgTv") {
57
- return "smart_tv_lg";
58
- } else if (deviceName == "vizioTv") {
59
- return "vizioTv";
60
- } else if(deviceName == "xfinityX1"){
61
- return "xfinityX1"
62
- }else if(deviceName == "xbox"){
63
- return "windows_xbox"
64
- }else {
65
- return "smart_tv_samsung";
66
- }
67
- }
68
-
69
- export const getMacros=(width, height,deviceName,deviceId)=>{
70
- let objMacros = {};
71
- try{
72
- objMacros["VIEWLIFT_WIDTH"] = width;
73
- objMacros["VIEWLIFT_HEIGHT"] = height;
74
- objMacros["VIEWLIFT_SIZE"] = width + "x" + height;
75
- objMacros["VIEWLIFT_DOMAIN"] = (window as any).appMainConfig.domainName;
76
-
77
- objMacros["VIEWLIFT_CACHEBUSTER"] = (new Date()).getTime();
78
- objMacros["VIEWLIFT_TIMESTAMP"] = Math.floor((new Date()).getTime() % 1000);
79
- objMacros["VIEWLIFT_TIMESTAMP_MS"] = (new Date()).getTime();
80
- objMacros["VIEWLIFT_USER_AGENT"] = window.navigator.userAgent;
81
-
82
- // objMacros["VIEWLIFT_DURATION"] = time;
83
- objMacros["VIEWLIFT_MIN_DURATION"] = "0";
84
-
85
- objMacros["VIEWLIFT_AUTOPLAY"] = "1";
86
- objMacros["VIEWLIFT_DNT"] = "0";
87
- objMacros["VIEWLIFT_AD_POS"] = "1";
88
- objMacros["VIEWLIFT_MUTE"] = "0";
89
- objMacros["VIEWLIFT_DEVICE_MAKE"] = getDeviceMaker(deviceName);
90
- objMacros["VIEWLIFT_OS"] = getOSName(deviceName);
91
- objMacros["VIEWLIFT_LAT"] = (window as any).geoLocation?.latitude;
92
- objMacros["VIEWLIFT_LON"] = (window as any).geoLocation?.longitude;
93
- objMacros["VIEWLIFT_KEYWORDS"] = "720";
94
- objMacros["VIEWLIFT_CONSENT"] = "0";
95
- objMacros["VIEWLIFT_US_PRIVACY"] = "1";
96
- objMacros["VIEWLIFT_COPPA"] = "0";
97
- objMacros["VIEWLIFT_BRAND_NAME"] = getDeviceMaker(deviceName);
98
- objMacros["VIEWLIFT_IP"] = (window as any).geoLocation?.origip;
99
- objMacros["VIEWLIFT_MAX_POD_DURATION"] = "120";
100
- objMacros["VIEWLIFT_MAX_POD_DURATION_MS"] = "120000";
101
-
102
- // objMacros["VIEWLIFT_APP_ID"] = "";
103
- objMacros["VIEWLIFT_DEVICE_ID"] = deviceId;
104
- objMacros["VIEWLIFT_DID"] = deviceId;
105
- //objMacros["VIEWLIFT_APP_NAME"] = "";
106
- objMacros["VIEWLIFT_GDPR"] = "0";
107
- }catch(e){}
108
- return objMacros;
109
- }