cafe-video-player 3.0.13 → 3.0.14

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 (74) hide show
  1. package/{VideoHighLighter-OBD2IGA6.js → VideoHighLighter-DUJF47R3.js} +2 -2
  2. package/{VideoHighLighter-OBD2IGA6.js.map → VideoHighLighter-DUJF47R3.js.map} +1 -1
  3. package/{VideoHighLighter-T2LVURER.mjs → VideoHighLighter-ZDZ7LZVD.mjs} +2 -2
  4. package/{VideoHighLighter-T2LVURER.mjs.map → VideoHighLighter-ZDZ7LZVD.mjs.map} +1 -1
  5. package/{backwardForward-ZUVULGGJ.mjs → backwardForward-3X63XNNJ.mjs} +2 -2
  6. package/{backwardForward-ZUVULGGJ.mjs.map → backwardForward-3X63XNNJ.mjs.map} +1 -1
  7. package/{backwardForward-S6ZHVC75.js → backwardForward-HTLSZBXC.js} +2 -2
  8. package/{backwardForward-S6ZHVC75.js.map → backwardForward-HTLSZBXC.js.map} +1 -1
  9. package/chunk-3TPEXSZV.js +2 -0
  10. package/{chunk-ZWGZGWEB.js.map → chunk-3TPEXSZV.js.map} +1 -1
  11. package/chunk-5UGSCO4K.js +3 -0
  12. package/{chunk-BFE2RKVK.js.map → chunk-5UGSCO4K.js.map} +1 -1
  13. package/{chunk-4XKL6TLO.mjs → chunk-6LGS5W4B.mjs} +2 -2
  14. package/{chunk-4XKL6TLO.mjs.map → chunk-6LGS5W4B.mjs.map} +1 -1
  15. package/{chunk-WU4GN63P.mjs → chunk-B2LB3L3X.mjs} +2 -2
  16. package/{chunk-WU4GN63P.mjs.map → chunk-B2LB3L3X.mjs.map} +1 -1
  17. package/{chunk-SKRDEKL2.mjs → chunk-EPUUJE7V.mjs} +4 -4
  18. package/{chunk-SKRDEKL2.mjs.map → chunk-EPUUJE7V.mjs.map} +1 -1
  19. package/{chunk-CCO6GDG2.mjs → chunk-HOAJ3EFI.mjs} +3 -3
  20. package/{chunk-CCO6GDG2.mjs.map → chunk-HOAJ3EFI.mjs.map} +1 -1
  21. package/chunk-HZASW2B2.js +2 -0
  22. package/{chunk-DJ6KVZRK.js.map → chunk-HZASW2B2.js.map} +1 -1
  23. package/{chunk-OGCKLRYP.js → chunk-ISVY5ION.js} +2 -2
  24. package/{chunk-OGCKLRYP.js.map → chunk-ISVY5ION.js.map} +1 -1
  25. package/{chunk-IBV5SFIT.js → chunk-K4YPVDEE.js} +2 -2
  26. package/{chunk-IBV5SFIT.js.map → chunk-K4YPVDEE.js.map} +1 -1
  27. package/{chunk-QM3W7EYS.js → chunk-KSZ35TPK.js} +2 -2
  28. package/{chunk-QM3W7EYS.js.map → chunk-KSZ35TPK.js.map} +1 -1
  29. package/{chunk-WFHA2FPC.js → chunk-MVNOUM3G.js} +5 -5
  30. package/{chunk-WFHA2FPC.js.map → chunk-MVNOUM3G.js.map} +1 -1
  31. package/{chunk-BC4366GN.mjs → chunk-NLCBOGTI.mjs} +2 -2
  32. package/{chunk-BC4366GN.mjs.map → chunk-NLCBOGTI.mjs.map} +1 -1
  33. package/{chunk-Y7BIYTQP.mjs → chunk-P46UX5ND.mjs} +2 -2
  34. package/{chunk-Y7BIYTQP.mjs.map → chunk-P46UX5ND.mjs.map} +1 -1
  35. package/{chunk-GYUGYOVP.mjs → chunk-P4O3IKAQ.mjs} +2 -2
  36. package/{chunk-GYUGYOVP.mjs.map → chunk-P4O3IKAQ.mjs.map} +1 -1
  37. package/{chunk-73KLK4QU.mjs → chunk-QFADUEGX.mjs} +2 -2
  38. package/{chunk-73KLK4QU.mjs.map → chunk-QFADUEGX.mjs.map} +1 -1
  39. package/{chunk-PKXJEXKI.mjs → chunk-UL5LQB3G.mjs} +2 -2
  40. package/{chunk-PKXJEXKI.mjs.map → chunk-UL5LQB3G.mjs.map} +1 -1
  41. package/{chunk-U3VFRU6R.js → chunk-VUHZVVMS.js} +2 -2
  42. package/{chunk-U3VFRU6R.js.map → chunk-VUHZVVMS.js.map} +1 -1
  43. package/{chunk-ZSSCZTW3.js → chunk-W5NVHMWX.js} +2 -2
  44. package/{chunk-ZSSCZTW3.js.map → chunk-W5NVHMWX.js.map} +1 -1
  45. package/index.js +1 -1
  46. package/index.mjs +1 -1
  47. package/{nonStaticVideoTag-6OHMSJEH.js → nonStaticVideoTag-5HEUBWAN.js} +2 -2
  48. package/{nonStaticVideoTag-6OHMSJEH.js.map → nonStaticVideoTag-5HEUBWAN.js.map} +1 -1
  49. package/{nonStaticVideoTag-J6JNATM6.mjs → nonStaticVideoTag-P47FI6UV.mjs} +2 -2
  50. package/{nonStaticVideoTag-J6JNATM6.mjs.map → nonStaticVideoTag-P47FI6UV.mjs.map} +1 -1
  51. package/package.json +1 -1
  52. package/staticPlayer-7LS2DPUR.js +2 -0
  53. package/{staticPlayer-TNS4JFRP.js.map → staticPlayer-7LS2DPUR.js.map} +1 -1
  54. package/{staticPlayer-2IO6XEKM.mjs → staticPlayer-J7Q3JXQ2.mjs} +2 -2
  55. package/{staticPlayer-2IO6XEKM.mjs.map → staticPlayer-J7Q3JXQ2.mjs.map} +1 -1
  56. package/{staticVideoTag-2YYZBRPY.mjs → staticVideoTag-JOPHGL3R.mjs} +2 -2
  57. package/{staticVideoTag-2YYZBRPY.mjs.map → staticVideoTag-JOPHGL3R.mjs.map} +1 -1
  58. package/{staticVideoTag-VLNCYNKV.js → staticVideoTag-OZZU5MWF.js} +2 -2
  59. package/{staticVideoTag-VLNCYNKV.js.map → staticVideoTag-OZZU5MWF.js.map} +1 -1
  60. package/videoArea-BVYEZUSL.mjs +2 -0
  61. package/{videoArea-2F2NDD76.mjs.map → videoArea-BVYEZUSL.mjs.map} +1 -1
  62. package/videoArea-M6ZAWJQW.js +2 -0
  63. package/{videoArea-35ABV3CM.js.map → videoArea-M6ZAWJQW.js.map} +1 -1
  64. package/videoPlayerStyles.css +4 -4
  65. package/{vodPlayer-337TYSU4.js → vodPlayer-B5JRKEU3.js} +2 -2
  66. package/{vodPlayer-337TYSU4.js.map → vodPlayer-B5JRKEU3.js.map} +1 -1
  67. package/{vodPlayer-JTS4WVOB.mjs → vodPlayer-GQETGYFT.mjs} +2 -2
  68. package/{vodPlayer-JTS4WVOB.mjs.map → vodPlayer-GQETGYFT.mjs.map} +1 -1
  69. package/chunk-BFE2RKVK.js +0 -3
  70. package/chunk-DJ6KVZRK.js +0 -2
  71. package/chunk-ZWGZGWEB.js +0 -2
  72. package/staticPlayer-TNS4JFRP.js +0 -2
  73. package/videoArea-2F2NDD76.mjs +0 -2
  74. package/videoArea-35ABV3CM.js +0 -2
package/index.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkDJ6KVZRK_js=require('./chunk-DJ6KVZRK.js'),chunkBNVNO5NH_js=require('./chunk-BNVNO5NH.js'),chunkZSSCZTW3_js=require('./chunk-ZSSCZTW3.js'),chunkOGCKLRYP_js=require('./chunk-OGCKLRYP.js'),chunkCOYFW7R4_js=require('./chunk-COYFW7R4.js'),chunkBFE2RKVK_js=require('./chunk-BFE2RKVK.js'),chunkU3VFRU6R_js=require('./chunk-U3VFRU6R.js'),chunkAN6JAJSI_js=require('./chunk-AN6JAJSI.js'),reactRedux=require('react-redux'),wt=require('react'),oe=require('next/dynamic'),z=require('next/image'),jsxRuntime=require('react/jsx-runtime'),Q=require('hls.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var wt__default=/*#__PURE__*/_interopDefault(wt);var oe__default=/*#__PURE__*/_interopDefault(oe);var z__default=/*#__PURE__*/_interopDefault(z);var Q__default=/*#__PURE__*/_interopDefault(Q);chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();var dt=e=>{let o=chunkAN6JAJSI_js.z(),l={},a=()=>{o(chunkU3VFRU6R_js.b(l)),o(chunkU3VFRU6R_js.g(true));},S=()=>{e.uuid&&(localStorage.setItem("hamrahiUUID",e.uuid),l.uuid=e.uuid);},y=()=>{l={provider:"cafevdo",...e,subtitles:void 0};},u=async()=>{l={uuid:chunkU3VFRU6R_js.ga(),provider:"cafevdo",...e,subtitles:void 0,id:e.id?window.atob(e.id):void 0,banner:e.banner&&e.banner!=="undefined"?e.banner:void 0};},m=async()=>{let V=await chunkBFE2RKVK_js.c(e.subtitles);o(chunkU3VFRU6R_js.h(V));},P=async()=>{l={},Object.keys(e).includes("type")&&(String(e.type)==="vod"?y():String(e.type)==="static"&&u(),e.subtitles&&e.subtitles.length&&m(),S(),a());};wt.useEffect(()=>{P();},[e]);},He=dt;chunkAN6JAJSI_js.e();var ut=()=>{chunkBNVNO5NH_js.a("Space",e=>{chunkU3VFRU6R_js.t("isPressKeySpace")&&!chunkU3VFRU6R_js.t("isFirstMutePlay")&&chunkU3VFRU6R_js.V(e);}),chunkBNVNO5NH_js.a("KeyK",e=>{chunkU3VFRU6R_js.t("isPressKeySpace")&&!chunkU3VFRU6R_js.t("isFirstMutePlay")&&chunkU3VFRU6R_js.V(e);}),chunkBNVNO5NH_js.a("KeyF",()=>{chunkU3VFRU6R_js.t("isPressKeyF")&&chunkU3VFRU6R_js._();}),chunkBNVNO5NH_js.a("KeyM",()=>{if(chunkU3VFRU6R_js.t("isPressKeyM")){let{settings:e}=chunkU3VFRU6R_js.Aa.getState().user;chunkU3VFRU6R_js.Y(e.volume?0:50);}});},Re=ut;chunkAN6JAJSI_js.e();var ct=({src:e,onEndAd:o,onSkipAd:l,skipDelay:a,adText:S="\u0627\u0637\u0644\u0627\u0639\u0627\u062A \u0628\u06CC\u0634\u062A\u0631",onClickAd:y})=>{let u=chunkAN6JAJSI_js.z(),m=wt.useRef(null),P=wt.useRef(null),{firstMute:V}=chunkAN6JAJSI_js.A(({controller:{firstMute:t}})=>({firstMute:t}),reactRedux.shallowEqual),[W,X]=wt.useState(0),[Ye,Ze]=wt.useState(0),B=a!==void 0&&a>0,[b,qe]=wt.useState(B?a:null),[se,H]=wt.useState(false),[M,et]=wt.useState(0),[pe,tt]=wt.useState(0),[rt,U]=wt.useState(true),C=wt.useRef(null),[de,R]=wt.useState(false),[lt,ot]=wt.useState(false),K=(t=3e3)=>{if(de){U(true);return}U(true),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{U(false);},t);};wt.useEffect(()=>{let t=m.current;if(!t)return;let s=()=>K(),N=()=>K();return t.addEventListener("mousemove",s),t.addEventListener("touchstart",N),K(),()=>{t.removeEventListener("mousemove",s),t.removeEventListener("touchstart",N),C.current&&clearTimeout(C.current);}},[de]),wt.useEffect(()=>{if(!B||!se)return;let t=setInterval(()=>{qe(s=>s===null?s:s<=1?(clearInterval(t),0):s-1);},1e3);return ()=>clearInterval(t)},[se,B]),wt.useEffect(()=>{let t=P.current;if(!t)return;let s=()=>{H(true),R(false),K(1e3);},N=()=>{H(true),R(false);},me=()=>{H(false),R(true),U(true),C.current&&clearTimeout(C.current);},ce=()=>H(false),fe=()=>H(false),he=()=>tt(t.duration);return t.addEventListener("play",s),t.addEventListener("playing",N),t.addEventListener("pause",me),t.addEventListener("waiting",ce),t.addEventListener("error",fe),t.addEventListener("loadedmetadata",he),chunkU3VFRU6R_js.xa(t),()=>{t.removeEventListener("play",s),t.removeEventListener("playing",N),t.removeEventListener("pause",me),t.removeEventListener("waiting",ce),t.removeEventListener("error",fe),t.removeEventListener("loadedmetadata",he);}},[e]);let it=()=>{let t=P.current;t?.duration&&(X(t.currentTime/t.duration*100),et(t.currentTime));},nt=()=>{let t=P.current;t?.duration&&t.buffered.length>0&&Ze(t.buffered.end(t.buffered.length-1)/t.duration*100);},at=t=>{let s=P.current;if(s){if(chunkU3VFRU6R_js.t("isTouchScreen")){if((t.target===m.current||t.target===s)&&V){chunkU3VFRU6R_js.Y(50,s),chunkU3VFRU6R_js.X();return}K();return}if(t.target===m.current||t.target===s){if(V){chunkU3VFRU6R_js.Y(50,s),chunkU3VFRU6R_js.X();return}s.paused?(s.play(),u(chunkAN6JAJSI_js.f(true))):(s.pause(),u(chunkAN6JAJSI_js.f(false)));}}},ue=()=>{y&&y(M);},_=t=>{let s=Math.floor(t/60).toString().padStart(2,"0"),N=Math.floor(t%60).toString().padStart(2,"0");return `${s}:${N}`};return chunkBNVNO5NH_js.a("Space",()=>{R(t=>!t);}),chunkBNVNO5NH_js.a("KeyK",()=>{R(t=>!t);}),chunkBNVNO5NH_js.a("KeyF",()=>{chunkU3VFRU6R_js._();}),chunkBNVNO5NH_js.a("KeyM",()=>{let{settings:t}=chunkU3VFRU6R_js.Aa.getState().user;chunkU3VFRU6R_js.Y(t.volume?0:50,P.current||void 0);}),jsxRuntime.jsxs("div",{id:"video-area",ref:m,onClick:at,onDoubleClick:()=>{chunkU3VFRU6R_js._(),chunkU3VFRU6R_js.$();},className:chunkU3VFRU6R_js.ea("pl-relative pl-bg-black pl-overflow-hidden pl-w-full pl-h-full pl-max-h-screen pl-aspect-video pl-flex pl-flex-col pl-justify-end",{desktop:"pl-rounded-[12px]",desktopFullScreen:"pl-fixed pl-w-screen pl-h-screen pl-top-0 pl-right-0 pl-rounded-none"}),style:{width:chunkU3VFRU6R_js.t("isFullScreen")?"100vw":"auto",zIndex:chunkU3VFRU6R_js.t("isFullScreen")?1e5:"unset",height:chunkU3VFRU6R_js.t("isFullScreen")?"100vh":"auto"},children:[jsxRuntime.jsxs("div",{className:"pl-absolute pl-top-0 pl-z-10 pl-h-[46px] pl-w-full pl-px-4 pl-flex pl-items-center pl-justify-between",style:{backgroundImage:"linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0) 100%)"},children:[y&&chunkU3VFRU6R_js.t("isTouchScreen")&&jsxRuntime.jsxs("button",{onClick:ue,className:chunkU3VFRU6R_js.ea("pl-flex pl-items-center pl-justify-center pl-gap-[5px]",{touch:"h-[50px]",touchFullScreen:""}),children:[jsxRuntime.jsx(z__default.default,{src:chunkCOYFW7R4_js.a.export,alt:"export button",width:16,height:16}),jsxRuntime.jsx("span",{className:chunkU3VFRU6R_js.ea("",{touch:"pl-text-white pl-text-[11px] pl-font-medium",touchFullScreen:""}),children:S})]}),chunkU3VFRU6R_js.t("showSoundVolumeAlert")&&jsxRuntime.jsx(chunkZSSCZTW3_js.c,{})]}),jsxRuntime.jsx("video",{src:e,autoPlay:true,playsInline:true,className:"pl-absolute pl-size-full",onEnded:()=>o&&o(M),onTimeUpdate:it,onProgress:nt,id:"player-tag"}),jsxRuntime.jsxs("div",{style:{backgroundBlendMode:"multiply",backgroundSize:"cover",backgroundPosition:"center"},className:`pl-relative pl-rounded-b-[12px] pl-z-10 pl-flex pl-flex-col ${chunkU3VFRU6R_js.t("isTouchScreenPortrait")&&"pl-flex-col-reverse"} ${chunkU3VFRU6R_js.t("isFullScreen")?"pl-gap-3":"pl-gap-1.5"} pl-transition-opacity pl-duration-500 pl-ease-in-out ${rt?"pl-opacity-100":"pl-opacity-0 pl-pointer-events-none"}`,children:[chunkU3VFRU6R_js.t("isTouchScreen")&&jsxRuntime.jsxs("div",{className:"pl-absolute pl-font-bold pl-text-[12px] pl-h-[14px] pl-gap-1.5 pl-left-[14px] pl-bottom-[14px] pl-flex pl-items-center pl-justify-center pl-w-fit pl-text-white",children:[jsxRuntime.jsx("p",{className:"pl-leading-[100%]",children:_(M)}),jsxRuntime.jsx(z__default.default,{src:chunkCOYFW7R4_js.a.info,alt:"",width:12,height:12}),jsxRuntime.jsx("p",{className:"pl-leading-[100%]",children:"\u062A\u0628\u0644\u06CC\u063A\u0627\u062A"})]}),jsxRuntime.jsx(ft,{progress:W,buffered:Ye}),!chunkU3VFRU6R_js.t("isTouchScreen")&&jsxRuntime.jsxs("div",{className:`pl-flex pl-justify-between pl-items-center pl-gap-3 pl-px-4 ${chunkU3VFRU6R_js.t("isFullScreen")?"pl-pb-3":"pl-pb-1.5"}`,children:[jsxRuntime.jsx("div",{className:chunkU3VFRU6R_js.ea("pl-rounded-full pl-flex pl-items-center pl-justify-center pl-bg-black/75",{desktop:"pl-p-1",desktopFullScreen:"pl-p-1.5"}),children:jsxRuntime.jsx(chunkOGCKLRYP_js.c,{width:chunkU3VFRU6R_js.t("isFullScreen")?24:16,height:chunkU3VFRU6R_js.t("isFullScreen")?24:16})}),jsxRuntime.jsxs("div",{className:"pl-flex pl-items-center pl-gap-4",children:[jsxRuntime.jsx("div",{onClick:()=>ot(t=>!t),className:chunkU3VFRU6R_js.ea("pl-cursor-pointer pl-rounded-full pl-inline-flex pl-items-center pl-py-1 pl-px-1.5 pl-justify-center pl-group pl-bg-black/75",{desktop:"pl-min-w-[34px] pl-h-[34px]",desktopFullScreen:"pl-min-w-[48px] pl-h-[48px]"}),children:jsxRuntime.jsx("div",{className:chunkU3VFRU6R_js.ea(" pl-flex pl-gap-0.5 pl-items-center pl-justify-center pl-rounded-full group-hover:pl-bg-[#5E5E5E] pl-transition-all",{desktop:"pl-h-[26px] pl-min-w-[26px] pl-px-1.5",desktopFullScreen:"pl-h-[36px] pl-min-w-[36px] pl-px-3"}),children:jsxRuntime.jsxs("p",{className:`pl-text-white pl-flex pl-items-center pl-justify-center pl-gap-0.5 ${chunkU3VFRU6R_js.t("isFullScreen")?"pl-text-base":"pl-text-[12px] pl-leading-5"} pl-font-bold`,children:[jsxRuntime.jsx("span",{children:_(pe)}),jsxRuntime.jsx("span",{children:"/"}),lt?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:_(pe-M)}),jsxRuntime.jsx("span",{className:"pl-mt-0.5",children:"-"})]}):jsxRuntime.jsx("span",{children:_(M)})]})})}),jsxRuntime.jsx(chunkOGCKLRYP_js.b,{width:chunkU3VFRU6R_js.t("isFullScreen")?24:16,height:chunkU3VFRU6R_js.t("isFullScreen")?24:16}),jsxRuntime.jsx(chunkZSSCZTW3_js.b,{width:chunkU3VFRU6R_js.t("isFullScreen")?24:16,height:chunkU3VFRU6R_js.t("isFullScreen")?24:16})]})]})]}),y&&!chunkU3VFRU6R_js.t("isTouchScreen")&&jsxRuntime.jsxs("button",{onClick:ue,className:chunkU3VFRU6R_js.ea("pl-left-[24px] pl-flex pl-items-center pl-rounded-[28px] pl-transition-colors pl-bg-[#212121]/[0.6] pl-absolute",{desktopFullScreen:"pl-bottom-[131px] pl-h-[56px] pl-px-5 pl-gap-2.5",desktop:"pl-bottom-[76px] pl-h-10 pl-px-3 pl-gap-1"}),children:[jsxRuntime.jsx(z__default.default,{src:chunkCOYFW7R4_js.a.export,alt:"export button",width:chunkU3VFRU6R_js.fa({desktop:16,desktopFullScreen:32,touch:20,touchFullScreen:24}),height:chunkU3VFRU6R_js.fa({desktop:16,desktopFullScreen:32,touch:20,touchFullScreen:24})}),jsxRuntime.jsx("span",{className:chunkU3VFRU6R_js.ea("pl-font-medium pl-text-white pl-leading-4",{desktopFullScreen:"pl-text-base",desktop:"pl-text-[13px]"}),children:S})]}),B&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:chunkU3VFRU6R_js.t("isTouchScreen")?jsxRuntime.jsxs("button",{onClick:()=>l&&l(M),disabled:!!b&&b>0,className:chunkU3VFRU6R_js.ea(`pl-absolute pl-px-2 pl-rounded-[28px] pl-bg-black/60 pl-bottom-8 pl-right-4 pl-flex pl-items-center pl-justify-center pl-h-8 pl-gap-1 ${b&&b>0?"pl-invisible":""}`,{touchFullScreen:"",touch:""}),children:[jsxRuntime.jsx(z__default.default,{src:chunkCOYFW7R4_js.a.next,alt:"next button",width:chunkU3VFRU6R_js.fa({touch:20,touchFullScreen:20}),height:chunkU3VFRU6R_js.fa({touch:20,touchFullScreen:20})}),jsxRuntime.jsx("span",{className:chunkU3VFRU6R_js.ea("pl-text-[11px] pl-font-medium pl-text-white",{touchFullScreen:"",touch:""}),children:"\u0631\u062F \u06A9\u0631\u062F\u0646"})]}):jsxRuntime.jsxs("button",{onClick:()=>l&&l(M),disabled:!!b&&b>0,className:chunkU3VFRU6R_js.ea("pl-right-[24px] pl-flex pl-items-center pl-rounded-[28px] pl-transition-colors pl-bg-[#212121]/[0.6] pl-absolute",{desktopFullScreen:"pl-bottom-[131px] pl-h-[56px] pl-px-5 pl-gap-2.5",desktop:"pl-bottom-[76px] pl-h-10 pl-px-3 pl-gap-1"}),children:[jsxRuntime.jsx(z__default.default,{src:chunkCOYFW7R4_js.a.next,alt:"next button",width:chunkU3VFRU6R_js.fa({desktop:16,desktopFullScreen:32}),height:chunkU3VFRU6R_js.fa({desktop:16,desktopFullScreen:32})}),jsxRuntime.jsx("span",{className:chunkU3VFRU6R_js.ea("pl-font-medium pl-text-white pl-leading-4",{desktopFullScreen:"pl-text-base",desktop:"pl-text-[13px]"}),children:b&&b>0?`\u0631\u062F \u06A9\u0631\u062F\u0646 (${b})`:"\u0631\u062F \u06A9\u0631\u062F\u0646"})]})})]})},$e=ct,ft=({progress:e,buffered:o})=>jsxRuntime.jsx("div",{className:chunkU3VFRU6R_js.ea("pl-w-full",{desktop:"pl-px-4"}),children:jsxRuntime.jsxs("div",{className:chunkU3VFRU6R_js.ea("pl-relative pl-overflow-hidden pl-w-full pl-bg-[#4A4A4A]",{touch:"pl-h-[3px]",desktop:"pl-h-[3px] pl-rounded-[8px]",desktopFullScreen:"pl-h-[6px]",touchFullScreen:"pl-h-[8px]"}),children:[jsxRuntime.jsx("div",{className:"pl-absolute pl-top-0 pl-left-0 pl-h-full pl-bg-[#C7C7C7]",style:{width:`${o}%`}}),jsxRuntime.jsx("div",{className:"pl-absolute pl-top-0 pl-left-0 pl-h-full pl-bg-[#FFCC00] pl-transition-all pl-duration-150 pl-ease-linear",style:{width:`${e}%`}})]})});var vt=oe__default.default(()=>import('./staticPlayer-TNS4JFRP.js')),gt=oe__default.default(()=>import('./vodPlayer-337TYSU4.js')),Pt=oe__default.default(()=>import('./VideoHighLighter-OBD2IGA6.js')),bt=e=>{let o=chunkAN6JAJSI_js.z(),{params:l,isLoading:a,firstPlay:S}=chunkAN6JAJSI_js.A(({videoData:{isReady:m,params:P,hiddenAd:V},controller:{isLoading:W,firstPlay:X}})=>({isReady:m,params:P,hiddenAd:V,isLoading:W,firstPlay:X}),reactRedux.shallowEqual);if(wt.useEffect(()=>(l.id&&e.params.id!==l.id&&chunkU3VFRU6R_js.oa(),()=>{chunkU3VFRU6R_js.oa();}),[e.params.id]),He(e.params),Re(),chunkAN6JAJSI_js.A(({controller:{isFullScreen:m}})=>({isFullScreen:m}),reactRedux.shallowEqual),e.params.vhl_status)return jsxRuntime.jsx(Pt,{});if(chunkU3VFRU6R_js.t("hasAdvertisement"))return jsxRuntime.jsx($e,{src:l.advertisement?.videoUrl,onSkipAd:m=>{o(chunkU3VFRU6R_js.n(true)),l.advertisement?.onSkipAd&&l.advertisement.onSkipAd(m);},onEndAd:m=>{o(chunkU3VFRU6R_js.n(true)),l.advertisement?.onEndAd&&l.advertisement.onEndAd(m);},skipDelay:l.advertisement?.skipDelay,adText:l.advertisement?.adText,onClickAd:l.advertisement?.onClickAd});let y=jsxRuntime.jsx(jsxRuntime.Fragment,{});chunkU3VFRU6R_js.t("isReady")&&(y=jsxRuntime.jsx("div",{className:chunkU3VFRU6R_js.ea("",{desktop:"pl-rounded-[12px]"}),style:{touchAction:"pan-y",userSelect:"none"},children:chunkU3VFRU6R_js.t("isStaticFormat")?jsxRuntime.jsx(vt,{}):jsxRuntime.jsx(gt,{})}));let u=S&&a;return jsxRuntime.jsxs("div",{dir:"rtl",style:{zIndex:1e3},id:"parent-player",className:chunkU3VFRU6R_js.ea("pl-relative pl-bg-black pl-w-full pl-h-full pl-aspect-video",{desktop:"pl-rounded-[12px]",touch:"",desktopFullScreen:"pl-overflow-hidden pl-fixed pl-top-0 pl-right-0 pl-w-screen pl-h-screen pl-rounded-none",touchFullScreen:"pl-overflow-hidden pl-fixed pl-top-0 pl-right-0 pl-w-screen pl-h-screen"}),children:[u&&jsxRuntime.jsx("div",{className:chunkU3VFRU6R_js.ea("pl-absolute pl-w-full pl-h-full pl-aspect-video",{desktop:"pl-rounded-[12px]"}),children:jsxRuntime.jsx(chunkZSSCZTW3_js.a,{})}),y]})},Be=bt;chunkAN6JAJSI_js.e();var ie=class extends wt__default.default.Component{state={hasError:false,error:null,errorInfo:null};static getDerivedStateFromError(o){return {hasError:true}}componentDidCatch(o,l){this.setState({error:o,errorInfo:l}),chunkU3VFRU6R_js.P({type:"OTHER_ERROR",message:o.message});}render(){return this.state.hasError?jsxRuntime.jsx(jsxRuntime.Fragment,{}):this.props.children}},j=ie;var Ct=({params:e})=>{let[o,l]=wt.useState(false);return wt.useEffect(()=>{l(true);},[]),o?jsxRuntime.jsx(reactRedux.Provider,{store:chunkU3VFRU6R_js.Aa,children:jsxRuntime.jsx(j,{children:jsxRuntime.jsx("div",{id:"video-player-container",className:`${!chunkU3VFRU6R_js.t("isTouchScreen")&&"pl-overflow-hidden"}`,children:jsxRuntime.jsx(Be,{params:e})})})}):null};chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();var At=()=>(chunkAN6JAJSI_js.A(({miniPlayer:{play:e}})=>({play:e}),reactRedux.shallowEqual),jsxRuntime.jsx("div",{className:`${!chunkU3VFRU6R_js.t("isTouchScreen")&&"hover:pl-scale-125"} pl-transition-transform pl-ease-in-out pl-cursor-pointer`,onContextMenu:e=>e.preventDefault(),children:jsxRuntime.jsx(z__default.default,{alt:"",src:chunkU3VFRU6R_js.t("isPlayMiniPlayer")?chunkCOYFW7R4_js.a.bigPause:chunkCOYFW7R4_js.a.bigPlay,width:20,height:20,onClick:e=>chunkU3VFRU6R_js.W(e),onDoubleClick:e=>e.stopPropagation(),className:`${chunkU3VFRU6R_js.t("isPlayMiniPlayer")?"pl-big-play-icon":"pl-big-pause-icon"}`})})),_e=At;chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();var Lt=()=>{let e=chunkAN6JAJSI_js.z(),o=chunkAN6JAJSI_js.A(a=>a.miniPlayer.details),l=chunkAN6JAJSI_js.A(a=>a.miniPlayer.params);return wt.useEffect(()=>{let a=new Q__default.default(chunkDJ6KVZRK_js.d());return Q__default.default.isSupported()?(a.attachMedia(document.getElementById("mini-player-video-tag")),a.on(Q__default.default.Events.MEDIA_ATTACHED,()=>chunkDJ6KVZRK_js.C(a))):chunkU3VFRU6R_js.x().canPlayType("application/vnd.apple.mpegurl")&&(chunkU3VFRU6R_js.x().src=o.stream_link,chunkDJ6KVZRK_js.b()),()=>{e(chunkU3VFRU6R_js.U()),a.detachMedia(),a.off(Q__default.default.Events.MEDIA_ATTACHED,()=>chunkDJ6KVZRK_js.C(a));}},[]),wt.useEffect(()=>{l.currentTime&&(e(chunkU3VFRU6R_js.T(true)),chunkU3VFRU6R_js.y().currentTime=l.currentTime,e(chunkAN6JAJSI_js.f(false)),chunkU3VFRU6R_js.x()?.pause());},[l.currentTime]),jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("video",{onPlay:()=>e(chunkU3VFRU6R_js.T(true)),onEnded:()=>e(chunkU3VFRU6R_js.T(false)),onError:chunkDJ6KVZRK_js.a,poster:l.banner?l.banner:o.banner,id:"mini-player-video-tag",className:"pl-absolute pl-bg-black pl-w-full pl-h-full",autoPlay:true,muted:true})})},je=Lt;chunkAN6JAJSI_js.e();var Ht=()=>{let e=chunkAN6JAJSI_js.z(),o=chunkAN6JAJSI_js.A(l=>l.miniPlayer.params);return wt.useEffect(()=>{o.currentTime&&(e(chunkU3VFRU6R_js.T(true)),chunkU3VFRU6R_js.y().currentTime=o.currentTime,e(chunkAN6JAJSI_js.f(false)),chunkU3VFRU6R_js.x()?.pause());},[o.currentTime]),jsxRuntime.jsx("video",{poster:o.banner,onPlay:()=>e(chunkU3VFRU6R_js.T(true)),onEnded:()=>e(chunkU3VFRU6R_js.T(false)),onError:chunkDJ6KVZRK_js.a,src:o.id,id:"mini-player-video-tag",className:"pl-absolute pl-bg-black pl-w-full pl-h-full",autoPlay:true})},Je=Ht;var Kt=()=>{let e=chunkAN6JAJSI_js.A(o=>o.miniPlayer.params.type);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e==="static"?jsxRuntime.jsx(Je,{}):jsxRuntime.jsx(je,{})})},Qe=Kt;var Xe=({params:e})=>{let o=chunkAN6JAJSI_js.z(),l=chunkAN6JAJSI_js.A(u=>u.miniPlayer.details),a=chunkAN6JAJSI_js.A(u=>u.miniPlayer.params);chunkAN6JAJSI_js.A(u=>u.miniPlayer.play);let S=chunkAN6JAJSI_js.A(u=>u.videoData.params);wt.useEffect(()=>{o(chunkU3VFRU6R_js.R(e));},[]);let y=async()=>await chunkBFE2RKVK_js.a(e.id);return wt.useEffect(()=>{e.id&&e.type==="vod"&&y();},[e.id]),jsxRuntime.jsx(jsxRuntime.Fragment,{children:l.stream_link||a.type==="static"&&a.id?jsxRuntime.jsxs("div",{style:{zIndex:1003},className:"pl-relative pl-w-full pl-h-full",children:[jsxRuntime.jsx("div",{className:"pl-absolute pl-z-[1000] pl-top-3 pl-right-3 pl-cursor-pointer",onClick:()=>{S.id===a.id&&(chunkU3VFRU6R_js.x().currentTime=chunkU3VFRU6R_js.y().currentTime,o(chunkAN6JAJSI_js.h(chunkU3VFRU6R_js.y().currentTime))),localStorage.setItem("close-miniPlayer","true"),e.onClose();},children:jsxRuntime.jsx(z__default.default,{className:"pl-cursor-pointer",src:chunkCOYFW7R4_js.a.closeSquare,alt:"close-square",width:16,height:16})}),jsxRuntime.jsx("div",{className:"pl-w-full pl-absolute pl-bottom-0 pl-z-[1000000]",children:jsxRuntime.jsx("div",{className:"pl-w-full pl-flex pl-justify-center",children:jsxRuntime.jsx(_e,{})})}),jsxRuntime.jsx(Qe,{})]}):jsxRuntime.jsx("div",{className:"pl-w-full pl-h-full pl-bg-white"})})};var jt=({params:e})=>{let[o,l]=wt.useState(false);return wt.useEffect(()=>{l(true);},[]),o?jsxRuntime.jsx(reactRedux.Provider,{store:chunkU3VFRU6R_js.Aa,children:jsxRuntime.jsx(j,{children:jsxRuntime.jsx(Xe,{params:e})})}):null};exports.MiniPlayerLibrary=jt;exports.VideoPlayerLibrary=Ct;//# sourceMappingURL=index.js.map
1
+ 'use strict';var chunkHZASW2B2_js=require('./chunk-HZASW2B2.js'),chunkBNVNO5NH_js=require('./chunk-BNVNO5NH.js'),chunkW5NVHMWX_js=require('./chunk-W5NVHMWX.js'),chunkISVY5ION_js=require('./chunk-ISVY5ION.js'),chunkCOYFW7R4_js=require('./chunk-COYFW7R4.js'),chunk5UGSCO4K_js=require('./chunk-5UGSCO4K.js'),chunkVUHZVVMS_js=require('./chunk-VUHZVVMS.js'),chunkAN6JAJSI_js=require('./chunk-AN6JAJSI.js'),reactRedux=require('react-redux'),wt=require('react'),oe=require('next/dynamic'),z=require('next/image'),jsxRuntime=require('react/jsx-runtime'),Q=require('hls.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var wt__default=/*#__PURE__*/_interopDefault(wt);var oe__default=/*#__PURE__*/_interopDefault(oe);var z__default=/*#__PURE__*/_interopDefault(z);var Q__default=/*#__PURE__*/_interopDefault(Q);chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();var dt=e=>{let o=chunkAN6JAJSI_js.z(),l={},a=()=>{o(chunkVUHZVVMS_js.b(l)),o(chunkVUHZVVMS_js.g(true));},S=()=>{e.uuid&&(localStorage.setItem("hamrahiUUID",e.uuid),l.uuid=e.uuid);},y=()=>{l={provider:"cafevdo",...e,subtitles:void 0};},u=async()=>{l={uuid:chunkVUHZVVMS_js.ga(),provider:"cafevdo",...e,subtitles:void 0,id:e.id?window.atob(e.id):void 0,banner:e.banner&&e.banner!=="undefined"?e.banner:void 0};},m=async()=>{let V=await chunk5UGSCO4K_js.c(e.subtitles);o(chunkVUHZVVMS_js.h(V));},P=async()=>{l={},Object.keys(e).includes("type")&&(String(e.type)==="vod"?y():String(e.type)==="static"&&u(),e.subtitles&&e.subtitles.length&&m(),S(),a());};wt.useEffect(()=>{P();},[e]);},He=dt;chunkAN6JAJSI_js.e();var ut=()=>{chunkBNVNO5NH_js.a("Space",e=>{chunkVUHZVVMS_js.t("isPressKeySpace")&&!chunkVUHZVVMS_js.t("isFirstMutePlay")&&chunkVUHZVVMS_js.V(e);}),chunkBNVNO5NH_js.a("KeyK",e=>{chunkVUHZVVMS_js.t("isPressKeySpace")&&!chunkVUHZVVMS_js.t("isFirstMutePlay")&&chunkVUHZVVMS_js.V(e);}),chunkBNVNO5NH_js.a("KeyF",()=>{chunkVUHZVVMS_js.t("isPressKeyF")&&chunkVUHZVVMS_js._();}),chunkBNVNO5NH_js.a("KeyM",()=>{if(chunkVUHZVVMS_js.t("isPressKeyM")){let{settings:e}=chunkVUHZVVMS_js.Aa.getState().user;chunkVUHZVVMS_js.Y(e.volume?0:50);}});},Re=ut;chunkAN6JAJSI_js.e();var ct=({src:e,onEndAd:o,onSkipAd:l,skipDelay:a,adText:S="\u0627\u0637\u0644\u0627\u0639\u0627\u062A \u0628\u06CC\u0634\u062A\u0631",onClickAd:y})=>{let u=chunkAN6JAJSI_js.z(),m=wt.useRef(null),P=wt.useRef(null),{firstMute:V}=chunkAN6JAJSI_js.A(({controller:{firstMute:t}})=>({firstMute:t}),reactRedux.shallowEqual),[W,X]=wt.useState(0),[Ye,Ze]=wt.useState(0),B=a!==void 0&&a>0,[b,qe]=wt.useState(B?a:null),[se,H]=wt.useState(false),[M,et]=wt.useState(0),[pe,tt]=wt.useState(0),[rt,U]=wt.useState(true),C=wt.useRef(null),[de,R]=wt.useState(false),[lt,ot]=wt.useState(false),K=(t=3e3)=>{if(de){U(true);return}U(true),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{U(false);},t);};wt.useEffect(()=>{let t=m.current;if(!t)return;let s=()=>K(),N=()=>K();return t.addEventListener("mousemove",s),t.addEventListener("touchstart",N),K(),()=>{t.removeEventListener("mousemove",s),t.removeEventListener("touchstart",N),C.current&&clearTimeout(C.current);}},[de]),wt.useEffect(()=>{if(!B||!se)return;let t=setInterval(()=>{qe(s=>s===null?s:s<=1?(clearInterval(t),0):s-1);},1e3);return ()=>clearInterval(t)},[se,B]),wt.useEffect(()=>{let t=P.current;if(!t)return;let s=()=>{H(true),R(false),K(1e3);},N=()=>{H(true),R(false);},me=()=>{H(false),R(true),U(true),C.current&&clearTimeout(C.current);},ce=()=>H(false),fe=()=>H(false),he=()=>tt(t.duration);return t.addEventListener("play",s),t.addEventListener("playing",N),t.addEventListener("pause",me),t.addEventListener("waiting",ce),t.addEventListener("error",fe),t.addEventListener("loadedmetadata",he),chunkVUHZVVMS_js.xa(t),()=>{t.removeEventListener("play",s),t.removeEventListener("playing",N),t.removeEventListener("pause",me),t.removeEventListener("waiting",ce),t.removeEventListener("error",fe),t.removeEventListener("loadedmetadata",he);}},[e]);let it=()=>{let t=P.current;t?.duration&&(X(t.currentTime/t.duration*100),et(t.currentTime));},nt=()=>{let t=P.current;t?.duration&&t.buffered.length>0&&Ze(t.buffered.end(t.buffered.length-1)/t.duration*100);},at=t=>{let s=P.current;if(s){if(chunkVUHZVVMS_js.t("isTouchScreen")){if((t.target===m.current||t.target===s)&&V){chunkVUHZVVMS_js.Y(50,s),chunkVUHZVVMS_js.X();return}K();return}if(t.target===m.current||t.target===s){if(V){chunkVUHZVVMS_js.Y(50,s),chunkVUHZVVMS_js.X();return}s.paused?(s.play(),u(chunkAN6JAJSI_js.f(true))):(s.pause(),u(chunkAN6JAJSI_js.f(false)));}}},ue=()=>{y&&y(M);},_=t=>{let s=Math.floor(t/60).toString().padStart(2,"0"),N=Math.floor(t%60).toString().padStart(2,"0");return `${s}:${N}`};return chunkBNVNO5NH_js.a("Space",()=>{R(t=>!t);}),chunkBNVNO5NH_js.a("KeyK",()=>{R(t=>!t);}),chunkBNVNO5NH_js.a("KeyF",()=>{chunkVUHZVVMS_js._();}),chunkBNVNO5NH_js.a("KeyM",()=>{let{settings:t}=chunkVUHZVVMS_js.Aa.getState().user;chunkVUHZVVMS_js.Y(t.volume?0:50,P.current||void 0);}),jsxRuntime.jsxs("div",{id:"video-area",ref:m,onClick:at,onDoubleClick:()=>{chunkVUHZVVMS_js._(),chunkVUHZVVMS_js.$();},className:chunkVUHZVVMS_js.ea("pl-relative pl-bg-black pl-overflow-hidden pl-w-full pl-h-full pl-max-h-screen pl-aspect-video pl-flex pl-flex-col pl-justify-end",{desktop:"pl-rounded-[12px]",desktopFullScreen:"pl-fixed pl-w-screen pl-h-screen pl-top-0 pl-right-0 pl-rounded-none"}),style:{width:chunkVUHZVVMS_js.t("isFullScreen")?"100vw":"auto",zIndex:chunkVUHZVVMS_js.t("isFullScreen")?1e5:"unset",height:chunkVUHZVVMS_js.t("isFullScreen")?"100vh":"auto"},children:[jsxRuntime.jsxs("div",{className:"pl-absolute pl-top-0 pl-z-10 pl-h-[46px] pl-w-full pl-px-4 pl-flex pl-items-center pl-justify-between",style:{backgroundImage:"linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0) 100%)"},children:[y&&chunkVUHZVVMS_js.t("isTouchScreen")&&jsxRuntime.jsxs("button",{onClick:ue,className:chunkVUHZVVMS_js.ea("pl-flex pl-items-center pl-justify-center pl-gap-[5px]",{touch:"h-[50px]",touchFullScreen:""}),children:[jsxRuntime.jsx(z__default.default,{src:chunkCOYFW7R4_js.a.export,alt:"export button",width:16,height:16}),jsxRuntime.jsx("span",{className:chunkVUHZVVMS_js.ea("",{touch:"pl-text-white pl-text-[11px] pl-font-medium",touchFullScreen:""}),children:S})]}),chunkVUHZVVMS_js.t("showSoundVolumeAlert")&&jsxRuntime.jsx(chunkW5NVHMWX_js.c,{})]}),jsxRuntime.jsx("video",{src:e,autoPlay:true,playsInline:true,className:"pl-absolute pl-size-full",onEnded:()=>o&&o(M),onTimeUpdate:it,onProgress:nt,id:"player-tag"}),jsxRuntime.jsxs("div",{style:{backgroundBlendMode:"multiply",backgroundSize:"cover",backgroundPosition:"center"},className:`pl-relative pl-rounded-b-[12px] pl-z-10 pl-flex pl-flex-col ${chunkVUHZVVMS_js.t("isTouchScreenPortrait")&&"pl-flex-col-reverse"} ${chunkVUHZVVMS_js.t("isFullScreen")?"pl-gap-3":"pl-gap-1.5"} pl-transition-opacity pl-duration-500 pl-ease-in-out ${rt?"pl-opacity-100":"pl-opacity-0 pl-pointer-events-none"}`,children:[chunkVUHZVVMS_js.t("isTouchScreen")&&jsxRuntime.jsxs("div",{className:"pl-absolute pl-font-bold pl-text-[12px] pl-h-[14px] pl-gap-1.5 pl-left-[14px] pl-bottom-[14px] pl-flex pl-items-center pl-justify-center pl-w-fit pl-text-white",children:[jsxRuntime.jsx("p",{className:"pl-leading-[100%]",children:_(M)}),jsxRuntime.jsx(z__default.default,{src:chunkCOYFW7R4_js.a.info,alt:"",width:12,height:12}),jsxRuntime.jsx("p",{className:"pl-leading-[100%]",children:"\u062A\u0628\u0644\u06CC\u063A\u0627\u062A"})]}),jsxRuntime.jsx(ft,{progress:W,buffered:Ye}),!chunkVUHZVVMS_js.t("isTouchScreen")&&jsxRuntime.jsxs("div",{className:`pl-flex pl-justify-between pl-items-center pl-gap-3 pl-px-4 ${chunkVUHZVVMS_js.t("isFullScreen")?"pl-pb-3":"pl-pb-1.5"}`,children:[jsxRuntime.jsx("div",{className:chunkVUHZVVMS_js.ea("pl-rounded-full pl-flex pl-items-center pl-justify-center pl-bg-black/75",{desktop:"pl-p-1",desktopFullScreen:"pl-p-1.5"}),children:jsxRuntime.jsx(chunkISVY5ION_js.c,{width:chunkVUHZVVMS_js.t("isFullScreen")?24:16,height:chunkVUHZVVMS_js.t("isFullScreen")?24:16})}),jsxRuntime.jsxs("div",{className:"pl-flex pl-items-center pl-gap-4",children:[jsxRuntime.jsx("div",{onClick:()=>ot(t=>!t),className:chunkVUHZVVMS_js.ea("pl-cursor-pointer pl-rounded-full pl-inline-flex pl-items-center pl-py-1 pl-px-1.5 pl-justify-center pl-group pl-bg-black/75",{desktop:"pl-min-w-[34px] pl-h-[34px]",desktopFullScreen:"pl-min-w-[48px] pl-h-[48px]"}),children:jsxRuntime.jsx("div",{className:chunkVUHZVVMS_js.ea(" pl-flex pl-gap-0.5 pl-items-center pl-justify-center pl-rounded-full group-hover:pl-bg-[#5E5E5E] pl-transition-all",{desktop:"pl-h-[26px] pl-min-w-[26px] pl-px-1.5",desktopFullScreen:"pl-h-[36px] pl-min-w-[36px] pl-px-3"}),children:jsxRuntime.jsxs("p",{className:`pl-text-white pl-flex pl-items-center pl-justify-center pl-gap-0.5 ${chunkVUHZVVMS_js.t("isFullScreen")?"pl-text-base":"pl-text-[12px] pl-leading-5"} pl-font-bold`,children:[jsxRuntime.jsx("span",{children:_(pe)}),jsxRuntime.jsx("span",{children:"/"}),lt?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:_(pe-M)}),jsxRuntime.jsx("span",{className:"pl-mt-0.5",children:"-"})]}):jsxRuntime.jsx("span",{children:_(M)})]})})}),jsxRuntime.jsx(chunkISVY5ION_js.b,{width:chunkVUHZVVMS_js.t("isFullScreen")?24:16,height:chunkVUHZVVMS_js.t("isFullScreen")?24:16}),jsxRuntime.jsx(chunkW5NVHMWX_js.b,{width:chunkVUHZVVMS_js.t("isFullScreen")?24:16,height:chunkVUHZVVMS_js.t("isFullScreen")?24:16})]})]})]}),y&&!chunkVUHZVVMS_js.t("isTouchScreen")&&jsxRuntime.jsxs("button",{onClick:ue,className:chunkVUHZVVMS_js.ea("pl-left-[24px] pl-flex pl-items-center pl-rounded-[28px] pl-transition-colors pl-bg-[#212121]/[0.6] pl-absolute",{desktopFullScreen:"pl-bottom-[131px] pl-h-[56px] pl-px-5 pl-gap-2.5",desktop:"pl-bottom-[76px] pl-h-10 pl-px-3 pl-gap-1"}),children:[jsxRuntime.jsx(z__default.default,{src:chunkCOYFW7R4_js.a.export,alt:"export button",width:chunkVUHZVVMS_js.fa({desktop:16,desktopFullScreen:32,touch:20,touchFullScreen:24}),height:chunkVUHZVVMS_js.fa({desktop:16,desktopFullScreen:32,touch:20,touchFullScreen:24})}),jsxRuntime.jsx("span",{className:chunkVUHZVVMS_js.ea("pl-font-medium pl-text-white pl-leading-4",{desktopFullScreen:"pl-text-base",desktop:"pl-text-[13px]"}),children:S})]}),B&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:chunkVUHZVVMS_js.t("isTouchScreen")?jsxRuntime.jsxs("button",{onClick:()=>l&&l(M),disabled:!!b&&b>0,className:chunkVUHZVVMS_js.ea(`pl-absolute pl-px-2 pl-rounded-[28px] pl-bg-black/60 pl-bottom-8 pl-right-4 pl-flex pl-items-center pl-justify-center pl-h-8 pl-gap-1 ${b&&b>0?"pl-invisible":""}`,{touchFullScreen:"",touch:""}),children:[jsxRuntime.jsx(z__default.default,{src:chunkCOYFW7R4_js.a.next,alt:"next button",width:chunkVUHZVVMS_js.fa({touch:20,touchFullScreen:20}),height:chunkVUHZVVMS_js.fa({touch:20,touchFullScreen:20})}),jsxRuntime.jsx("span",{className:chunkVUHZVVMS_js.ea("pl-text-[11px] pl-font-medium pl-text-white",{touchFullScreen:"",touch:""}),children:"\u0631\u062F \u06A9\u0631\u062F\u0646"})]}):jsxRuntime.jsxs("button",{onClick:()=>l&&l(M),disabled:!!b&&b>0,className:chunkVUHZVVMS_js.ea("pl-right-[24px] pl-flex pl-items-center pl-rounded-[28px] pl-transition-colors pl-bg-[#212121]/[0.6] pl-absolute",{desktopFullScreen:"pl-bottom-[131px] pl-h-[56px] pl-px-5 pl-gap-2.5",desktop:"pl-bottom-[76px] pl-h-10 pl-px-3 pl-gap-1"}),children:[jsxRuntime.jsx(z__default.default,{src:chunkCOYFW7R4_js.a.next,alt:"next button",width:chunkVUHZVVMS_js.fa({desktop:16,desktopFullScreen:32}),height:chunkVUHZVVMS_js.fa({desktop:16,desktopFullScreen:32})}),jsxRuntime.jsx("span",{className:chunkVUHZVVMS_js.ea("pl-font-medium pl-text-white pl-leading-4",{desktopFullScreen:"pl-text-base",desktop:"pl-text-[13px]"}),children:b&&b>0?`\u0631\u062F \u06A9\u0631\u062F\u0646 (${b})`:"\u0631\u062F \u06A9\u0631\u062F\u0646"})]})})]})},$e=ct,ft=({progress:e,buffered:o})=>jsxRuntime.jsx("div",{className:chunkVUHZVVMS_js.ea("pl-w-full",{desktop:"pl-px-4"}),children:jsxRuntime.jsxs("div",{className:chunkVUHZVVMS_js.ea("pl-relative pl-overflow-hidden pl-w-full pl-bg-[#4A4A4A]",{touch:"pl-h-[3px]",desktop:"pl-h-[3px] pl-rounded-[8px]",desktopFullScreen:"pl-h-[6px]",touchFullScreen:"pl-h-[8px]"}),children:[jsxRuntime.jsx("div",{className:"pl-absolute pl-top-0 pl-left-0 pl-h-full pl-bg-[#C7C7C7]",style:{width:`${o}%`}}),jsxRuntime.jsx("div",{className:"pl-absolute pl-top-0 pl-left-0 pl-h-full pl-bg-[#FFCC00] pl-transition-all pl-duration-150 pl-ease-linear",style:{width:`${e}%`}})]})});var vt=oe__default.default(()=>import('./staticPlayer-7LS2DPUR.js')),gt=oe__default.default(()=>import('./vodPlayer-B5JRKEU3.js')),Pt=oe__default.default(()=>import('./VideoHighLighter-DUJF47R3.js')),bt=e=>{let o=chunkAN6JAJSI_js.z(),{params:l,isLoading:a,firstPlay:S}=chunkAN6JAJSI_js.A(({videoData:{isReady:m,params:P,hiddenAd:V},controller:{isLoading:W,firstPlay:X}})=>({isReady:m,params:P,hiddenAd:V,isLoading:W,firstPlay:X}),reactRedux.shallowEqual);if(wt.useEffect(()=>(l.id&&e.params.id!==l.id&&chunkVUHZVVMS_js.oa(),()=>{chunkVUHZVVMS_js.oa();}),[e.params.id]),He(e.params),Re(),chunkAN6JAJSI_js.A(({controller:{isFullScreen:m}})=>({isFullScreen:m}),reactRedux.shallowEqual),e.params.vhl_status)return jsxRuntime.jsx(Pt,{});if(chunkVUHZVVMS_js.t("hasAdvertisement"))return jsxRuntime.jsx($e,{src:l.advertisement?.videoUrl,onSkipAd:m=>{o(chunkVUHZVVMS_js.n(true)),l.advertisement?.onSkipAd&&l.advertisement.onSkipAd(m);},onEndAd:m=>{o(chunkVUHZVVMS_js.n(true)),l.advertisement?.onEndAd&&l.advertisement.onEndAd(m);},skipDelay:l.advertisement?.skipDelay,adText:l.advertisement?.adText,onClickAd:l.advertisement?.onClickAd});let y=jsxRuntime.jsx(jsxRuntime.Fragment,{});chunkVUHZVVMS_js.t("isReady")&&(y=jsxRuntime.jsx("div",{className:chunkVUHZVVMS_js.ea("",{desktop:"pl-rounded-[12px]"}),style:{touchAction:"pan-y",userSelect:"none"},children:chunkVUHZVVMS_js.t("isStaticFormat")?jsxRuntime.jsx(vt,{}):jsxRuntime.jsx(gt,{})}));let u=S&&a;return jsxRuntime.jsxs("div",{dir:"rtl",style:{zIndex:1e3},id:"parent-player",className:chunkVUHZVVMS_js.ea("pl-relative pl-bg-black pl-w-full pl-h-full pl-aspect-video",{desktop:"pl-rounded-[12px]",touch:"",desktopFullScreen:"pl-overflow-hidden pl-fixed pl-top-0 pl-right-0 pl-w-screen pl-h-screen pl-rounded-none",touchFullScreen:"pl-overflow-hidden pl-fixed pl-top-0 pl-right-0 pl-w-screen pl-h-screen"}),children:[u&&jsxRuntime.jsx("div",{className:chunkVUHZVVMS_js.ea("pl-absolute pl-w-full pl-h-full pl-aspect-video",{desktop:"pl-rounded-[12px]"}),children:jsxRuntime.jsx(chunkW5NVHMWX_js.a,{})}),y]})},Be=bt;chunkAN6JAJSI_js.e();var ie=class extends wt__default.default.Component{state={hasError:false,error:null,errorInfo:null};static getDerivedStateFromError(o){return {hasError:true}}componentDidCatch(o,l){this.setState({error:o,errorInfo:l}),chunkVUHZVVMS_js.P({type:"OTHER_ERROR",message:o.message});}render(){return this.state.hasError?jsxRuntime.jsx(jsxRuntime.Fragment,{}):this.props.children}},j=ie;var Ct=({params:e})=>{let[o,l]=wt.useState(false);return wt.useEffect(()=>{l(true);},[]),o?jsxRuntime.jsx(reactRedux.Provider,{store:chunkVUHZVVMS_js.Aa,children:jsxRuntime.jsx(j,{children:jsxRuntime.jsx("div",{id:"video-player-container",className:`${!chunkVUHZVVMS_js.t("isTouchScreen")&&"pl-overflow-hidden"}`,children:jsxRuntime.jsx(Be,{params:e})})})}):null};chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();var At=()=>(chunkAN6JAJSI_js.A(({miniPlayer:{play:e}})=>({play:e}),reactRedux.shallowEqual),jsxRuntime.jsx("div",{className:`${!chunkVUHZVVMS_js.t("isTouchScreen")&&"hover:pl-scale-125"} pl-transition-transform pl-ease-in-out pl-cursor-pointer`,onContextMenu:e=>e.preventDefault(),children:jsxRuntime.jsx(z__default.default,{alt:"",src:chunkVUHZVVMS_js.t("isPlayMiniPlayer")?chunkCOYFW7R4_js.a.bigPause:chunkCOYFW7R4_js.a.bigPlay,width:20,height:20,onClick:e=>chunkVUHZVVMS_js.W(e),onDoubleClick:e=>e.stopPropagation(),className:`${chunkVUHZVVMS_js.t("isPlayMiniPlayer")?"pl-big-play-icon":"pl-big-pause-icon"}`})})),_e=At;chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();var Lt=()=>{let e=chunkAN6JAJSI_js.z(),o=chunkAN6JAJSI_js.A(a=>a.miniPlayer.details),l=chunkAN6JAJSI_js.A(a=>a.miniPlayer.params);return wt.useEffect(()=>{let a=new Q__default.default(chunkHZASW2B2_js.d());return Q__default.default.isSupported()?(a.attachMedia(document.getElementById("mini-player-video-tag")),a.on(Q__default.default.Events.MEDIA_ATTACHED,()=>chunkHZASW2B2_js.C(a))):chunkVUHZVVMS_js.x().canPlayType("application/vnd.apple.mpegurl")&&(chunkVUHZVVMS_js.x().src=o.stream_link,chunkHZASW2B2_js.b()),()=>{e(chunkVUHZVVMS_js.U()),a.detachMedia(),a.off(Q__default.default.Events.MEDIA_ATTACHED,()=>chunkHZASW2B2_js.C(a));}},[]),wt.useEffect(()=>{l.currentTime&&(e(chunkVUHZVVMS_js.T(true)),chunkVUHZVVMS_js.y().currentTime=l.currentTime,e(chunkAN6JAJSI_js.f(false)),chunkVUHZVVMS_js.x()?.pause());},[l.currentTime]),jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("video",{onPlay:()=>e(chunkVUHZVVMS_js.T(true)),onEnded:()=>e(chunkVUHZVVMS_js.T(false)),onError:chunkHZASW2B2_js.a,poster:l.banner?l.banner:o.banner,id:"mini-player-video-tag",className:"pl-absolute pl-bg-black pl-w-full pl-h-full",autoPlay:true,muted:true})})},je=Lt;chunkAN6JAJSI_js.e();var Ht=()=>{let e=chunkAN6JAJSI_js.z(),o=chunkAN6JAJSI_js.A(l=>l.miniPlayer.params);return wt.useEffect(()=>{o.currentTime&&(e(chunkVUHZVVMS_js.T(true)),chunkVUHZVVMS_js.y().currentTime=o.currentTime,e(chunkAN6JAJSI_js.f(false)),chunkVUHZVVMS_js.x()?.pause());},[o.currentTime]),jsxRuntime.jsx("video",{poster:o.banner,onPlay:()=>e(chunkVUHZVVMS_js.T(true)),onEnded:()=>e(chunkVUHZVVMS_js.T(false)),onError:chunkHZASW2B2_js.a,src:o.id,id:"mini-player-video-tag",className:"pl-absolute pl-bg-black pl-w-full pl-h-full",autoPlay:true})},Je=Ht;var Kt=()=>{let e=chunkAN6JAJSI_js.A(o=>o.miniPlayer.params.type);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e==="static"?jsxRuntime.jsx(Je,{}):jsxRuntime.jsx(je,{})})},Qe=Kt;var Xe=({params:e})=>{let o=chunkAN6JAJSI_js.z(),l=chunkAN6JAJSI_js.A(u=>u.miniPlayer.details),a=chunkAN6JAJSI_js.A(u=>u.miniPlayer.params);chunkAN6JAJSI_js.A(u=>u.miniPlayer.play);let S=chunkAN6JAJSI_js.A(u=>u.videoData.params);wt.useEffect(()=>{o(chunkVUHZVVMS_js.R(e));},[]);let y=async()=>await chunk5UGSCO4K_js.a(e.id);return wt.useEffect(()=>{e.id&&e.type==="vod"&&y();},[e.id]),jsxRuntime.jsx(jsxRuntime.Fragment,{children:l.stream_link||a.type==="static"&&a.id?jsxRuntime.jsxs("div",{style:{zIndex:1003},className:"pl-relative pl-w-full pl-h-full",children:[jsxRuntime.jsx("div",{className:"pl-absolute pl-z-[1000] pl-top-3 pl-right-3 pl-cursor-pointer",onClick:()=>{S.id===a.id&&(chunkVUHZVVMS_js.x().currentTime=chunkVUHZVVMS_js.y().currentTime,o(chunkAN6JAJSI_js.h(chunkVUHZVVMS_js.y().currentTime))),localStorage.setItem("close-miniPlayer","true"),e.onClose();},children:jsxRuntime.jsx(z__default.default,{className:"pl-cursor-pointer",src:chunkCOYFW7R4_js.a.closeSquare,alt:"close-square",width:16,height:16})}),jsxRuntime.jsx("div",{className:"pl-w-full pl-absolute pl-bottom-0 pl-z-[1000000]",children:jsxRuntime.jsx("div",{className:"pl-w-full pl-flex pl-justify-center",children:jsxRuntime.jsx(_e,{})})}),jsxRuntime.jsx(Qe,{})]}):jsxRuntime.jsx("div",{className:"pl-w-full pl-h-full pl-bg-white"})})};var jt=({params:e})=>{let[o,l]=wt.useState(false);return wt.useEffect(()=>{l(true);},[]),o?jsxRuntime.jsx(reactRedux.Provider,{store:chunkVUHZVVMS_js.Aa,children:jsxRuntime.jsx(j,{children:jsxRuntime.jsx(Xe,{params:e})})}):null};exports.MiniPlayerLibrary=jt;exports.VideoPlayerLibrary=Ct;//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
package/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import {a as a$4,d,C,b as b$2}from'./chunk-73KLK4QU.mjs';import {a as a$2}from'./chunk-FXAWDALE.mjs';import {a,c,b as b$1}from'./chunk-Y7BIYTQP.mjs';import {c as c$1,b}from'./chunk-WU4GN63P.mjs';import {a as a$1}from'./chunk-XKRBXZUB.mjs';import {a as a$3,c as c$2}from'./chunk-CCO6GDG2.mjs';import {P,Aa,t,oa,n,ea,R,x,y,xa,_,Y,fa,$,W,V,X,T,U,ga,h as h$1,b as b$3,g}from'./chunk-BC4366GN.mjs';import {e,z,A,h,f}from'./chunk-4QMWBTB5.mjs';import {Provider,shallowEqual}from'react-redux';import Et,{useState,useEffect,useRef}from'react';import ie from'next/dynamic';import B from'next/image';import {jsx,Fragment,jsxs}from'react/jsx-runtime';import W$1 from'hls.js';e();e();e();e();var ut=e=>{let o=z(),l={},a=()=>{o(b$3(l)),o(g(true));},w=()=>{e.uuid&&(localStorage.setItem("hamrahiUUID",e.uuid),l.uuid=e.uuid);},v=()=>{l={provider:"cafevdo",...e,subtitles:void 0};},u=async()=>{l={uuid:ga(),provider:"cafevdo",...e,subtitles:void 0,id:e.id?window.atob(e.id):void 0,banner:e.banner&&e.banner!=="undefined"?e.banner:void 0};},m=async()=>{let D=await c$2(e.subtitles);o(h$1(D));},b=async()=>{l={},Object.keys(e).includes("type")&&(String(e.type)==="vod"?v():String(e.type)==="static"&&u(),e.subtitles&&e.subtitles.length&&m(),w(),a());};useEffect(()=>{b();},[e]);},Re=ut;e();var mt=()=>{a$2("Space",e=>{t("isPressKeySpace")&&!t("isFirstMutePlay")&&V(e);}),a$2("KeyK",e=>{t("isPressKeySpace")&&!t("isFirstMutePlay")&&V(e);}),a$2("KeyF",()=>{t("isPressKeyF")&&_();}),a$2("KeyM",()=>{if(t("isPressKeyM")){let{settings:e}=Aa.getState().user;Y(e.volume?0:50);}});},Ke=mt;e();var ft=({src:e,onEndAd:o,onSkipAd:l,skipDelay:a,adText:w="\u0627\u0637\u0644\u0627\u0639\u0627\u062A \u0628\u06CC\u0634\u062A\u0631",onClickAd:v})=>{let u=z(),m=useRef(null),b$2=useRef(null),{firstMute:D}=A(({controller:{firstMute:t}})=>({firstMute:t}),shallowEqual),[X$1,Y$1]=useState(0),[Ze,qe]=useState(0),U=a!==void 0&&a>0,[x,et]=useState(U?a:null),[pe,R]=useState(false),[C,tt]=useState(0),[de,rt]=useState(0),[lt,_$1]=useState(true),N=useRef(null),[ue,K]=useState(false),[ot,it]=useState(false),$$1=(t=3e3)=>{if(ue){_$1(true);return}_$1(true),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{_$1(false);},t);};useEffect(()=>{let t=m.current;if(!t)return;let s=()=>$$1(),I=()=>$$1();return t.addEventListener("mousemove",s),t.addEventListener("touchstart",I),$$1(),()=>{t.removeEventListener("mousemove",s),t.removeEventListener("touchstart",I),N.current&&clearTimeout(N.current);}},[ue]),useEffect(()=>{if(!U||!pe)return;let t=setInterval(()=>{et(s=>s===null?s:s<=1?(clearInterval(t),0):s-1);},1e3);return ()=>clearInterval(t)},[pe,U]),useEffect(()=>{let t=b$2.current;if(!t)return;let s=()=>{R(true),K(false),$$1(1e3);},I=()=>{R(true),K(false);},ce=()=>{R(false),K(true),_$1(true),N.current&&clearTimeout(N.current);},fe=()=>R(false),he=()=>R(false),ye=()=>rt(t.duration);return t.addEventListener("play",s),t.addEventListener("playing",I),t.addEventListener("pause",ce),t.addEventListener("waiting",fe),t.addEventListener("error",he),t.addEventListener("loadedmetadata",ye),xa(t),()=>{t.removeEventListener("play",s),t.removeEventListener("playing",I),t.removeEventListener("pause",ce),t.removeEventListener("waiting",fe),t.removeEventListener("error",he),t.removeEventListener("loadedmetadata",ye);}},[e]);let nt=()=>{let t=b$2.current;t?.duration&&(Y$1(t.currentTime/t.duration*100),tt(t.currentTime));},at=()=>{let t=b$2.current;t?.duration&&t.buffered.length>0&&qe(t.buffered.end(t.buffered.length-1)/t.duration*100);},st=t$1=>{let s=b$2.current;if(s){if(t("isTouchScreen")){if((t$1.target===m.current||t$1.target===s)&&D){Y(50,s),X();return}$$1();return}if(t$1.target===m.current||t$1.target===s){if(D){Y(50,s),X();return}s.paused?(s.play(),u(f(true))):(s.pause(),u(f(false)));}}},me=()=>{v&&v(C);},O=t=>{let s=Math.floor(t/60).toString().padStart(2,"0"),I=Math.floor(t%60).toString().padStart(2,"0");return `${s}:${I}`};return a$2("Space",()=>{K(t=>!t);}),a$2("KeyK",()=>{K(t=>!t);}),a$2("KeyF",()=>{_();}),a$2("KeyM",()=>{let{settings:t}=Aa.getState().user;Y(t.volume?0:50,b$2.current||void 0);}),jsxs("div",{id:"video-area",ref:m,onClick:st,onDoubleClick:()=>{_(),$();},className:ea("pl-relative pl-bg-black pl-overflow-hidden pl-w-full pl-h-full pl-max-h-screen pl-aspect-video pl-flex pl-flex-col pl-justify-end",{desktop:"pl-rounded-[12px]",desktopFullScreen:"pl-fixed pl-w-screen pl-h-screen pl-top-0 pl-right-0 pl-rounded-none"}),style:{width:t("isFullScreen")?"100vw":"auto",zIndex:t("isFullScreen")?1e5:"unset",height:t("isFullScreen")?"100vh":"auto"},children:[jsxs("div",{className:"pl-absolute pl-top-0 pl-z-10 pl-h-[46px] pl-w-full pl-px-4 pl-flex pl-items-center pl-justify-between",style:{backgroundImage:"linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0) 100%)"},children:[v&&t("isTouchScreen")&&jsxs("button",{onClick:me,className:ea("pl-flex pl-items-center pl-justify-center pl-gap-[5px]",{touch:"h-[50px]",touchFullScreen:""}),children:[jsx(B,{src:a$1.export,alt:"export button",width:16,height:16}),jsx("span",{className:ea("",{touch:"pl-text-white pl-text-[11px] pl-font-medium",touchFullScreen:""}),children:w})]}),t("showSoundVolumeAlert")&&jsx(c,{})]}),jsx("video",{src:e,autoPlay:true,playsInline:true,className:"pl-absolute pl-size-full",onEnded:()=>o&&o(C),onTimeUpdate:nt,onProgress:at,id:"player-tag"}),jsxs("div",{style:{backgroundBlendMode:"multiply",backgroundSize:"cover",backgroundPosition:"center"},className:`pl-relative pl-rounded-b-[12px] pl-z-10 pl-flex pl-flex-col ${t("isTouchScreenPortrait")&&"pl-flex-col-reverse"} ${t("isFullScreen")?"pl-gap-3":"pl-gap-1.5"} pl-transition-opacity pl-duration-500 pl-ease-in-out ${lt?"pl-opacity-100":"pl-opacity-0 pl-pointer-events-none"}`,children:[t("isTouchScreen")&&jsxs("div",{className:"pl-absolute pl-font-bold pl-text-[12px] pl-h-[14px] pl-gap-1.5 pl-left-[14px] pl-bottom-[14px] pl-flex pl-items-center pl-justify-center pl-w-fit pl-text-white",children:[jsx("p",{className:"pl-leading-[100%]",children:O(C)}),jsx(B,{src:a$1.info,alt:"",width:12,height:12}),jsx("p",{className:"pl-leading-[100%]",children:"\u062A\u0628\u0644\u06CC\u063A\u0627\u062A"})]}),jsx(ht,{progress:X$1,buffered:Ze}),!t("isTouchScreen")&&jsxs("div",{className:`pl-flex pl-justify-between pl-items-center pl-gap-3 pl-px-4 ${t("isFullScreen")?"pl-pb-3":"pl-pb-1.5"}`,children:[jsx("div",{className:ea("pl-rounded-full pl-flex pl-items-center pl-justify-center pl-bg-black/75",{desktop:"pl-p-1",desktopFullScreen:"pl-p-1.5"}),children:jsx(c$1,{width:t("isFullScreen")?24:16,height:t("isFullScreen")?24:16})}),jsxs("div",{className:"pl-flex pl-items-center pl-gap-4",children:[jsx("div",{onClick:()=>it(t=>!t),className:ea("pl-cursor-pointer pl-rounded-full pl-inline-flex pl-items-center pl-py-1 pl-px-1.5 pl-justify-center pl-group pl-bg-black/75",{desktop:"pl-min-w-[34px] pl-h-[34px]",desktopFullScreen:"pl-min-w-[48px] pl-h-[48px]"}),children:jsx("div",{className:ea(" pl-flex pl-gap-0.5 pl-items-center pl-justify-center pl-rounded-full group-hover:pl-bg-[#5E5E5E] pl-transition-all",{desktop:"pl-h-[26px] pl-min-w-[26px] pl-px-1.5",desktopFullScreen:"pl-h-[36px] pl-min-w-[36px] pl-px-3"}),children:jsxs("p",{className:`pl-text-white pl-flex pl-items-center pl-justify-center pl-gap-0.5 ${t("isFullScreen")?"pl-text-base":"pl-text-[12px] pl-leading-5"} pl-font-bold`,children:[jsx("span",{children:O(de)}),jsx("span",{children:"/"}),ot?jsxs(Fragment,{children:[jsx("span",{children:O(de-C)}),jsx("span",{className:"pl-mt-0.5",children:"-"})]}):jsx("span",{children:O(C)})]})})}),jsx(b,{width:t("isFullScreen")?24:16,height:t("isFullScreen")?24:16}),jsx(b$1,{width:t("isFullScreen")?24:16,height:t("isFullScreen")?24:16})]})]})]}),v&&!t("isTouchScreen")&&jsxs("button",{onClick:me,className:ea("pl-left-[24px] pl-flex pl-items-center pl-rounded-[28px] pl-transition-colors pl-bg-[#212121]/[0.6] pl-absolute",{desktopFullScreen:"pl-bottom-[131px] pl-h-[56px] pl-px-5 pl-gap-2.5",desktop:"pl-bottom-[76px] pl-h-10 pl-px-3 pl-gap-1"}),children:[jsx(B,{src:a$1.export,alt:"export button",width:fa({desktop:16,desktopFullScreen:32,touch:20,touchFullScreen:24}),height:fa({desktop:16,desktopFullScreen:32,touch:20,touchFullScreen:24})}),jsx("span",{className:ea("pl-font-medium pl-text-white pl-leading-4",{desktopFullScreen:"pl-text-base",desktop:"pl-text-[13px]"}),children:w})]}),U&&jsx(Fragment,{children:t("isTouchScreen")?jsxs("button",{onClick:()=>l&&l(C),disabled:!!x&&x>0,className:ea(`pl-absolute pl-px-2 pl-rounded-[28px] pl-bg-black/60 pl-bottom-8 pl-right-4 pl-flex pl-items-center pl-justify-center pl-h-8 pl-gap-1 ${x&&x>0?"pl-invisible":""}`,{touchFullScreen:"",touch:""}),children:[jsx(B,{src:a$1.next,alt:"next button",width:fa({touch:20,touchFullScreen:20}),height:fa({touch:20,touchFullScreen:20})}),jsx("span",{className:ea("pl-text-[11px] pl-font-medium pl-text-white",{touchFullScreen:"",touch:""}),children:"\u0631\u062F \u06A9\u0631\u062F\u0646"})]}):jsxs("button",{onClick:()=>l&&l(C),disabled:!!x&&x>0,className:ea("pl-right-[24px] pl-flex pl-items-center pl-rounded-[28px] pl-transition-colors pl-bg-[#212121]/[0.6] pl-absolute",{desktopFullScreen:"pl-bottom-[131px] pl-h-[56px] pl-px-5 pl-gap-2.5",desktop:"pl-bottom-[76px] pl-h-10 pl-px-3 pl-gap-1"}),children:[jsx(B,{src:a$1.next,alt:"next button",width:fa({desktop:16,desktopFullScreen:32}),height:fa({desktop:16,desktopFullScreen:32})}),jsx("span",{className:ea("pl-font-medium pl-text-white pl-leading-4",{desktopFullScreen:"pl-text-base",desktop:"pl-text-[13px]"}),children:x&&x>0?`\u0631\u062F \u06A9\u0631\u062F\u0646 (${x})`:"\u0631\u062F \u06A9\u0631\u062F\u0646"})]})})]})},ze=ft,ht=({progress:e,buffered:o})=>jsx("div",{className:ea("pl-w-full",{desktop:"pl-px-4"}),children:jsxs("div",{className:ea("pl-relative pl-overflow-hidden pl-w-full pl-bg-[#4A4A4A]",{touch:"pl-h-[3px]",desktop:"pl-h-[3px] pl-rounded-[8px]",desktopFullScreen:"pl-h-[6px]",touchFullScreen:"pl-h-[8px]"}),children:[jsx("div",{className:"pl-absolute pl-top-0 pl-left-0 pl-h-full pl-bg-[#C7C7C7]",style:{width:`${o}%`}}),jsx("div",{className:"pl-absolute pl-top-0 pl-left-0 pl-h-full pl-bg-[#FFCC00] pl-transition-all pl-duration-150 pl-ease-linear",style:{width:`${e}%`}})]})});var gt=ie(()=>import('./staticPlayer-2IO6XEKM.mjs')),Pt=ie(()=>import('./vodPlayer-JTS4WVOB.mjs')),bt=ie(()=>import('./VideoHighLighter-T2LVURER.mjs')),xt=e=>{let o=z(),{params:l,isLoading:a$1,firstPlay:w}=A(({videoData:{isReady:m,params:b,hiddenAd:D},controller:{isLoading:X,firstPlay:Y}})=>({isReady:m,params:b,hiddenAd:D,isLoading:X,firstPlay:Y}),shallowEqual);if(useEffect(()=>(l.id&&e.params.id!==l.id&&oa(),()=>{oa();}),[e.params.id]),Re(e.params),Ke(),A(({controller:{isFullScreen:m}})=>({isFullScreen:m}),shallowEqual),e.params.vhl_status)return jsx(bt,{});if(t("hasAdvertisement"))return jsx(ze,{src:l.advertisement?.videoUrl,onSkipAd:m=>{o(n(true)),l.advertisement?.onSkipAd&&l.advertisement.onSkipAd(m);},onEndAd:m=>{o(n(true)),l.advertisement?.onEndAd&&l.advertisement.onEndAd(m);},skipDelay:l.advertisement?.skipDelay,adText:l.advertisement?.adText,onClickAd:l.advertisement?.onClickAd});let v=jsx(Fragment,{});t("isReady")&&(v=jsx("div",{className:ea("",{desktop:"pl-rounded-[12px]"}),style:{touchAction:"pan-y",userSelect:"none"},children:t("isStaticFormat")?jsx(gt,{}):jsx(Pt,{})}));let u=w&&a$1;return jsxs("div",{dir:"rtl",style:{zIndex:1e3},id:"parent-player",className:ea("pl-relative pl-bg-black pl-w-full pl-h-full pl-aspect-video",{desktop:"pl-rounded-[12px]",touch:"",desktopFullScreen:"pl-overflow-hidden pl-fixed pl-top-0 pl-right-0 pl-w-screen pl-h-screen pl-rounded-none",touchFullScreen:"pl-overflow-hidden pl-fixed pl-top-0 pl-right-0 pl-w-screen pl-h-screen"}),children:[u&&jsx("div",{className:ea("pl-absolute pl-w-full pl-h-full pl-aspect-video",{desktop:"pl-rounded-[12px]"}),children:jsx(a,{})}),v]})},Ue=xt;e();var ne=class extends Et.Component{state={hasError:false,error:null,errorInfo:null};static getDerivedStateFromError(o){return {hasError:true}}componentDidCatch(o,l){this.setState({error:o,errorInfo:l}),P({type:"OTHER_ERROR",message:o.message});}render(){return this.state.hasError?jsx(Fragment,{}):this.props.children}},J=ne;var Nt=({params:e})=>{let[o,l]=useState(false);return useEffect(()=>{l(true);},[]),o?jsx(Provider,{store:Aa,children:jsx(J,{children:jsx("div",{id:"video-player-container",className:`${!t("isTouchScreen")&&"pl-overflow-hidden"}`,children:jsx(Ue,{params:e})})})}):null};e();e();e();var Lt=()=>(A(({miniPlayer:{play:e}})=>({play:e}),shallowEqual),jsx("div",{className:`${!t("isTouchScreen")&&"hover:pl-scale-125"} pl-transition-transform pl-ease-in-out pl-cursor-pointer`,onContextMenu:e=>e.preventDefault(),children:jsx(B,{alt:"",src:t("isPlayMiniPlayer")?a$1.bigPause:a$1.bigPlay,width:20,height:20,onClick:e=>W(e),onDoubleClick:e=>e.stopPropagation(),className:`${t("isPlayMiniPlayer")?"pl-big-play-icon":"pl-big-pause-icon"}`})})),Oe=Lt;e();e();var Vt=()=>{let e=z(),o=A(a=>a.miniPlayer.details),l=A(a=>a.miniPlayer.params);return useEffect(()=>{let a=new W$1(d());return W$1.isSupported()?(a.attachMedia(document.getElementById("mini-player-video-tag")),a.on(W$1.Events.MEDIA_ATTACHED,()=>C(a))):x().canPlayType("application/vnd.apple.mpegurl")&&(x().src=o.stream_link,b$2()),()=>{e(U()),a.detachMedia(),a.off(W$1.Events.MEDIA_ATTACHED,()=>C(a));}},[]),useEffect(()=>{l.currentTime&&(e(T(true)),y().currentTime=l.currentTime,e(f(false)),x()?.pause());},[l.currentTime]),jsx(Fragment,{children:jsx("video",{onPlay:()=>e(T(true)),onEnded:()=>e(T(false)),onError:a$4,poster:l.banner?l.banner:o.banner,id:"mini-player-video-tag",className:"pl-absolute pl-bg-black pl-w-full pl-h-full",autoPlay:true,muted:true})})},Je=Vt;e();var Rt=()=>{let e=z(),o=A(l=>l.miniPlayer.params);return useEffect(()=>{o.currentTime&&(e(T(true)),y().currentTime=o.currentTime,e(f(false)),x()?.pause());},[o.currentTime]),jsx("video",{poster:o.banner,onPlay:()=>e(T(true)),onEnded:()=>e(T(false)),onError:a$4,src:o.id,id:"mini-player-video-tag",className:"pl-absolute pl-bg-black pl-w-full pl-h-full",autoPlay:true})},Qe=Rt;var $t=()=>{let e=A(o=>o.miniPlayer.params.type);return jsx(Fragment,{children:e==="static"?jsx(Qe,{}):jsx(Je,{})})},We=$t;var Ye=({params:e})=>{let o=z(),l=A(u=>u.miniPlayer.details),a=A(u=>u.miniPlayer.params);A(u=>u.miniPlayer.play);let w=A(u=>u.videoData.params);useEffect(()=>{o(R(e));},[]);let v=async()=>await a$3(e.id);return useEffect(()=>{e.id&&e.type==="vod"&&v();},[e.id]),jsx(Fragment,{children:l.stream_link||a.type==="static"&&a.id?jsxs("div",{style:{zIndex:1003},className:"pl-relative pl-w-full pl-h-full",children:[jsx("div",{className:"pl-absolute pl-z-[1000] pl-top-3 pl-right-3 pl-cursor-pointer",onClick:()=>{w.id===a.id&&(x().currentTime=y().currentTime,o(h(y().currentTime))),localStorage.setItem("close-miniPlayer","true"),e.onClose();},children:jsx(B,{className:"pl-cursor-pointer",src:a$1.closeSquare,alt:"close-square",width:16,height:16})}),jsx("div",{className:"pl-w-full pl-absolute pl-bottom-0 pl-z-[1000000]",children:jsx("div",{className:"pl-w-full pl-flex pl-justify-center",children:jsx(Oe,{})})}),jsx(We,{})]}):jsx("div",{className:"pl-w-full pl-h-full pl-bg-white"})})};var Jt=({params:e})=>{let[o,l]=useState(false);return useEffect(()=>{l(true);},[]),o?jsx(Provider,{store:Aa,children:jsx(J,{children:jsx(Ye,{params:e})})}):null};export{Jt as MiniPlayerLibrary,Nt as VideoPlayerLibrary};//# sourceMappingURL=index.mjs.map
1
+ import {a as a$4,d,C,b as b$2}from'./chunk-QFADUEGX.mjs';import {a as a$2}from'./chunk-FXAWDALE.mjs';import {a,c,b as b$1}from'./chunk-P46UX5ND.mjs';import {c as c$1,b}from'./chunk-B2LB3L3X.mjs';import {a as a$1}from'./chunk-XKRBXZUB.mjs';import {a as a$3,c as c$2}from'./chunk-HOAJ3EFI.mjs';import {P,Aa,t,oa,n,ea,R,x,y,xa,_,Y,fa,$,W,V,X,T,U,ga,h as h$1,b as b$3,g}from'./chunk-NLCBOGTI.mjs';import {e,z,A,h,f}from'./chunk-4QMWBTB5.mjs';import {Provider,shallowEqual}from'react-redux';import Et,{useState,useEffect,useRef}from'react';import ie from'next/dynamic';import B from'next/image';import {jsx,Fragment,jsxs}from'react/jsx-runtime';import W$1 from'hls.js';e();e();e();e();var ut=e=>{let o=z(),l={},a=()=>{o(b$3(l)),o(g(true));},w=()=>{e.uuid&&(localStorage.setItem("hamrahiUUID",e.uuid),l.uuid=e.uuid);},v=()=>{l={provider:"cafevdo",...e,subtitles:void 0};},u=async()=>{l={uuid:ga(),provider:"cafevdo",...e,subtitles:void 0,id:e.id?window.atob(e.id):void 0,banner:e.banner&&e.banner!=="undefined"?e.banner:void 0};},m=async()=>{let D=await c$2(e.subtitles);o(h$1(D));},b=async()=>{l={},Object.keys(e).includes("type")&&(String(e.type)==="vod"?v():String(e.type)==="static"&&u(),e.subtitles&&e.subtitles.length&&m(),w(),a());};useEffect(()=>{b();},[e]);},Re=ut;e();var mt=()=>{a$2("Space",e=>{t("isPressKeySpace")&&!t("isFirstMutePlay")&&V(e);}),a$2("KeyK",e=>{t("isPressKeySpace")&&!t("isFirstMutePlay")&&V(e);}),a$2("KeyF",()=>{t("isPressKeyF")&&_();}),a$2("KeyM",()=>{if(t("isPressKeyM")){let{settings:e}=Aa.getState().user;Y(e.volume?0:50);}});},Ke=mt;e();var ft=({src:e,onEndAd:o,onSkipAd:l,skipDelay:a,adText:w="\u0627\u0637\u0644\u0627\u0639\u0627\u062A \u0628\u06CC\u0634\u062A\u0631",onClickAd:v})=>{let u=z(),m=useRef(null),b$2=useRef(null),{firstMute:D}=A(({controller:{firstMute:t}})=>({firstMute:t}),shallowEqual),[X$1,Y$1]=useState(0),[Ze,qe]=useState(0),U=a!==void 0&&a>0,[x,et]=useState(U?a:null),[pe,R]=useState(false),[C,tt]=useState(0),[de,rt]=useState(0),[lt,_$1]=useState(true),N=useRef(null),[ue,K]=useState(false),[ot,it]=useState(false),$$1=(t=3e3)=>{if(ue){_$1(true);return}_$1(true),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{_$1(false);},t);};useEffect(()=>{let t=m.current;if(!t)return;let s=()=>$$1(),I=()=>$$1();return t.addEventListener("mousemove",s),t.addEventListener("touchstart",I),$$1(),()=>{t.removeEventListener("mousemove",s),t.removeEventListener("touchstart",I),N.current&&clearTimeout(N.current);}},[ue]),useEffect(()=>{if(!U||!pe)return;let t=setInterval(()=>{et(s=>s===null?s:s<=1?(clearInterval(t),0):s-1);},1e3);return ()=>clearInterval(t)},[pe,U]),useEffect(()=>{let t=b$2.current;if(!t)return;let s=()=>{R(true),K(false),$$1(1e3);},I=()=>{R(true),K(false);},ce=()=>{R(false),K(true),_$1(true),N.current&&clearTimeout(N.current);},fe=()=>R(false),he=()=>R(false),ye=()=>rt(t.duration);return t.addEventListener("play",s),t.addEventListener("playing",I),t.addEventListener("pause",ce),t.addEventListener("waiting",fe),t.addEventListener("error",he),t.addEventListener("loadedmetadata",ye),xa(t),()=>{t.removeEventListener("play",s),t.removeEventListener("playing",I),t.removeEventListener("pause",ce),t.removeEventListener("waiting",fe),t.removeEventListener("error",he),t.removeEventListener("loadedmetadata",ye);}},[e]);let nt=()=>{let t=b$2.current;t?.duration&&(Y$1(t.currentTime/t.duration*100),tt(t.currentTime));},at=()=>{let t=b$2.current;t?.duration&&t.buffered.length>0&&qe(t.buffered.end(t.buffered.length-1)/t.duration*100);},st=t$1=>{let s=b$2.current;if(s){if(t("isTouchScreen")){if((t$1.target===m.current||t$1.target===s)&&D){Y(50,s),X();return}$$1();return}if(t$1.target===m.current||t$1.target===s){if(D){Y(50,s),X();return}s.paused?(s.play(),u(f(true))):(s.pause(),u(f(false)));}}},me=()=>{v&&v(C);},O=t=>{let s=Math.floor(t/60).toString().padStart(2,"0"),I=Math.floor(t%60).toString().padStart(2,"0");return `${s}:${I}`};return a$2("Space",()=>{K(t=>!t);}),a$2("KeyK",()=>{K(t=>!t);}),a$2("KeyF",()=>{_();}),a$2("KeyM",()=>{let{settings:t}=Aa.getState().user;Y(t.volume?0:50,b$2.current||void 0);}),jsxs("div",{id:"video-area",ref:m,onClick:st,onDoubleClick:()=>{_(),$();},className:ea("pl-relative pl-bg-black pl-overflow-hidden pl-w-full pl-h-full pl-max-h-screen pl-aspect-video pl-flex pl-flex-col pl-justify-end",{desktop:"pl-rounded-[12px]",desktopFullScreen:"pl-fixed pl-w-screen pl-h-screen pl-top-0 pl-right-0 pl-rounded-none"}),style:{width:t("isFullScreen")?"100vw":"auto",zIndex:t("isFullScreen")?1e5:"unset",height:t("isFullScreen")?"100vh":"auto"},children:[jsxs("div",{className:"pl-absolute pl-top-0 pl-z-10 pl-h-[46px] pl-w-full pl-px-4 pl-flex pl-items-center pl-justify-between",style:{backgroundImage:"linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0) 100%)"},children:[v&&t("isTouchScreen")&&jsxs("button",{onClick:me,className:ea("pl-flex pl-items-center pl-justify-center pl-gap-[5px]",{touch:"h-[50px]",touchFullScreen:""}),children:[jsx(B,{src:a$1.export,alt:"export button",width:16,height:16}),jsx("span",{className:ea("",{touch:"pl-text-white pl-text-[11px] pl-font-medium",touchFullScreen:""}),children:w})]}),t("showSoundVolumeAlert")&&jsx(c,{})]}),jsx("video",{src:e,autoPlay:true,playsInline:true,className:"pl-absolute pl-size-full",onEnded:()=>o&&o(C),onTimeUpdate:nt,onProgress:at,id:"player-tag"}),jsxs("div",{style:{backgroundBlendMode:"multiply",backgroundSize:"cover",backgroundPosition:"center"},className:`pl-relative pl-rounded-b-[12px] pl-z-10 pl-flex pl-flex-col ${t("isTouchScreenPortrait")&&"pl-flex-col-reverse"} ${t("isFullScreen")?"pl-gap-3":"pl-gap-1.5"} pl-transition-opacity pl-duration-500 pl-ease-in-out ${lt?"pl-opacity-100":"pl-opacity-0 pl-pointer-events-none"}`,children:[t("isTouchScreen")&&jsxs("div",{className:"pl-absolute pl-font-bold pl-text-[12px] pl-h-[14px] pl-gap-1.5 pl-left-[14px] pl-bottom-[14px] pl-flex pl-items-center pl-justify-center pl-w-fit pl-text-white",children:[jsx("p",{className:"pl-leading-[100%]",children:O(C)}),jsx(B,{src:a$1.info,alt:"",width:12,height:12}),jsx("p",{className:"pl-leading-[100%]",children:"\u062A\u0628\u0644\u06CC\u063A\u0627\u062A"})]}),jsx(ht,{progress:X$1,buffered:Ze}),!t("isTouchScreen")&&jsxs("div",{className:`pl-flex pl-justify-between pl-items-center pl-gap-3 pl-px-4 ${t("isFullScreen")?"pl-pb-3":"pl-pb-1.5"}`,children:[jsx("div",{className:ea("pl-rounded-full pl-flex pl-items-center pl-justify-center pl-bg-black/75",{desktop:"pl-p-1",desktopFullScreen:"pl-p-1.5"}),children:jsx(c$1,{width:t("isFullScreen")?24:16,height:t("isFullScreen")?24:16})}),jsxs("div",{className:"pl-flex pl-items-center pl-gap-4",children:[jsx("div",{onClick:()=>it(t=>!t),className:ea("pl-cursor-pointer pl-rounded-full pl-inline-flex pl-items-center pl-py-1 pl-px-1.5 pl-justify-center pl-group pl-bg-black/75",{desktop:"pl-min-w-[34px] pl-h-[34px]",desktopFullScreen:"pl-min-w-[48px] pl-h-[48px]"}),children:jsx("div",{className:ea(" pl-flex pl-gap-0.5 pl-items-center pl-justify-center pl-rounded-full group-hover:pl-bg-[#5E5E5E] pl-transition-all",{desktop:"pl-h-[26px] pl-min-w-[26px] pl-px-1.5",desktopFullScreen:"pl-h-[36px] pl-min-w-[36px] pl-px-3"}),children:jsxs("p",{className:`pl-text-white pl-flex pl-items-center pl-justify-center pl-gap-0.5 ${t("isFullScreen")?"pl-text-base":"pl-text-[12px] pl-leading-5"} pl-font-bold`,children:[jsx("span",{children:O(de)}),jsx("span",{children:"/"}),ot?jsxs(Fragment,{children:[jsx("span",{children:O(de-C)}),jsx("span",{className:"pl-mt-0.5",children:"-"})]}):jsx("span",{children:O(C)})]})})}),jsx(b,{width:t("isFullScreen")?24:16,height:t("isFullScreen")?24:16}),jsx(b$1,{width:t("isFullScreen")?24:16,height:t("isFullScreen")?24:16})]})]})]}),v&&!t("isTouchScreen")&&jsxs("button",{onClick:me,className:ea("pl-left-[24px] pl-flex pl-items-center pl-rounded-[28px] pl-transition-colors pl-bg-[#212121]/[0.6] pl-absolute",{desktopFullScreen:"pl-bottom-[131px] pl-h-[56px] pl-px-5 pl-gap-2.5",desktop:"pl-bottom-[76px] pl-h-10 pl-px-3 pl-gap-1"}),children:[jsx(B,{src:a$1.export,alt:"export button",width:fa({desktop:16,desktopFullScreen:32,touch:20,touchFullScreen:24}),height:fa({desktop:16,desktopFullScreen:32,touch:20,touchFullScreen:24})}),jsx("span",{className:ea("pl-font-medium pl-text-white pl-leading-4",{desktopFullScreen:"pl-text-base",desktop:"pl-text-[13px]"}),children:w})]}),U&&jsx(Fragment,{children:t("isTouchScreen")?jsxs("button",{onClick:()=>l&&l(C),disabled:!!x&&x>0,className:ea(`pl-absolute pl-px-2 pl-rounded-[28px] pl-bg-black/60 pl-bottom-8 pl-right-4 pl-flex pl-items-center pl-justify-center pl-h-8 pl-gap-1 ${x&&x>0?"pl-invisible":""}`,{touchFullScreen:"",touch:""}),children:[jsx(B,{src:a$1.next,alt:"next button",width:fa({touch:20,touchFullScreen:20}),height:fa({touch:20,touchFullScreen:20})}),jsx("span",{className:ea("pl-text-[11px] pl-font-medium pl-text-white",{touchFullScreen:"",touch:""}),children:"\u0631\u062F \u06A9\u0631\u062F\u0646"})]}):jsxs("button",{onClick:()=>l&&l(C),disabled:!!x&&x>0,className:ea("pl-right-[24px] pl-flex pl-items-center pl-rounded-[28px] pl-transition-colors pl-bg-[#212121]/[0.6] pl-absolute",{desktopFullScreen:"pl-bottom-[131px] pl-h-[56px] pl-px-5 pl-gap-2.5",desktop:"pl-bottom-[76px] pl-h-10 pl-px-3 pl-gap-1"}),children:[jsx(B,{src:a$1.next,alt:"next button",width:fa({desktop:16,desktopFullScreen:32}),height:fa({desktop:16,desktopFullScreen:32})}),jsx("span",{className:ea("pl-font-medium pl-text-white pl-leading-4",{desktopFullScreen:"pl-text-base",desktop:"pl-text-[13px]"}),children:x&&x>0?`\u0631\u062F \u06A9\u0631\u062F\u0646 (${x})`:"\u0631\u062F \u06A9\u0631\u062F\u0646"})]})})]})},ze=ft,ht=({progress:e,buffered:o})=>jsx("div",{className:ea("pl-w-full",{desktop:"pl-px-4"}),children:jsxs("div",{className:ea("pl-relative pl-overflow-hidden pl-w-full pl-bg-[#4A4A4A]",{touch:"pl-h-[3px]",desktop:"pl-h-[3px] pl-rounded-[8px]",desktopFullScreen:"pl-h-[6px]",touchFullScreen:"pl-h-[8px]"}),children:[jsx("div",{className:"pl-absolute pl-top-0 pl-left-0 pl-h-full pl-bg-[#C7C7C7]",style:{width:`${o}%`}}),jsx("div",{className:"pl-absolute pl-top-0 pl-left-0 pl-h-full pl-bg-[#FFCC00] pl-transition-all pl-duration-150 pl-ease-linear",style:{width:`${e}%`}})]})});var gt=ie(()=>import('./staticPlayer-J7Q3JXQ2.mjs')),Pt=ie(()=>import('./vodPlayer-GQETGYFT.mjs')),bt=ie(()=>import('./VideoHighLighter-ZDZ7LZVD.mjs')),xt=e=>{let o=z(),{params:l,isLoading:a$1,firstPlay:w}=A(({videoData:{isReady:m,params:b,hiddenAd:D},controller:{isLoading:X,firstPlay:Y}})=>({isReady:m,params:b,hiddenAd:D,isLoading:X,firstPlay:Y}),shallowEqual);if(useEffect(()=>(l.id&&e.params.id!==l.id&&oa(),()=>{oa();}),[e.params.id]),Re(e.params),Ke(),A(({controller:{isFullScreen:m}})=>({isFullScreen:m}),shallowEqual),e.params.vhl_status)return jsx(bt,{});if(t("hasAdvertisement"))return jsx(ze,{src:l.advertisement?.videoUrl,onSkipAd:m=>{o(n(true)),l.advertisement?.onSkipAd&&l.advertisement.onSkipAd(m);},onEndAd:m=>{o(n(true)),l.advertisement?.onEndAd&&l.advertisement.onEndAd(m);},skipDelay:l.advertisement?.skipDelay,adText:l.advertisement?.adText,onClickAd:l.advertisement?.onClickAd});let v=jsx(Fragment,{});t("isReady")&&(v=jsx("div",{className:ea("",{desktop:"pl-rounded-[12px]"}),style:{touchAction:"pan-y",userSelect:"none"},children:t("isStaticFormat")?jsx(gt,{}):jsx(Pt,{})}));let u=w&&a$1;return jsxs("div",{dir:"rtl",style:{zIndex:1e3},id:"parent-player",className:ea("pl-relative pl-bg-black pl-w-full pl-h-full pl-aspect-video",{desktop:"pl-rounded-[12px]",touch:"",desktopFullScreen:"pl-overflow-hidden pl-fixed pl-top-0 pl-right-0 pl-w-screen pl-h-screen pl-rounded-none",touchFullScreen:"pl-overflow-hidden pl-fixed pl-top-0 pl-right-0 pl-w-screen pl-h-screen"}),children:[u&&jsx("div",{className:ea("pl-absolute pl-w-full pl-h-full pl-aspect-video",{desktop:"pl-rounded-[12px]"}),children:jsx(a,{})}),v]})},Ue=xt;e();var ne=class extends Et.Component{state={hasError:false,error:null,errorInfo:null};static getDerivedStateFromError(o){return {hasError:true}}componentDidCatch(o,l){this.setState({error:o,errorInfo:l}),P({type:"OTHER_ERROR",message:o.message});}render(){return this.state.hasError?jsx(Fragment,{}):this.props.children}},J=ne;var Nt=({params:e})=>{let[o,l]=useState(false);return useEffect(()=>{l(true);},[]),o?jsx(Provider,{store:Aa,children:jsx(J,{children:jsx("div",{id:"video-player-container",className:`${!t("isTouchScreen")&&"pl-overflow-hidden"}`,children:jsx(Ue,{params:e})})})}):null};e();e();e();var Lt=()=>(A(({miniPlayer:{play:e}})=>({play:e}),shallowEqual),jsx("div",{className:`${!t("isTouchScreen")&&"hover:pl-scale-125"} pl-transition-transform pl-ease-in-out pl-cursor-pointer`,onContextMenu:e=>e.preventDefault(),children:jsx(B,{alt:"",src:t("isPlayMiniPlayer")?a$1.bigPause:a$1.bigPlay,width:20,height:20,onClick:e=>W(e),onDoubleClick:e=>e.stopPropagation(),className:`${t("isPlayMiniPlayer")?"pl-big-play-icon":"pl-big-pause-icon"}`})})),Oe=Lt;e();e();var Vt=()=>{let e=z(),o=A(a=>a.miniPlayer.details),l=A(a=>a.miniPlayer.params);return useEffect(()=>{let a=new W$1(d());return W$1.isSupported()?(a.attachMedia(document.getElementById("mini-player-video-tag")),a.on(W$1.Events.MEDIA_ATTACHED,()=>C(a))):x().canPlayType("application/vnd.apple.mpegurl")&&(x().src=o.stream_link,b$2()),()=>{e(U()),a.detachMedia(),a.off(W$1.Events.MEDIA_ATTACHED,()=>C(a));}},[]),useEffect(()=>{l.currentTime&&(e(T(true)),y().currentTime=l.currentTime,e(f(false)),x()?.pause());},[l.currentTime]),jsx(Fragment,{children:jsx("video",{onPlay:()=>e(T(true)),onEnded:()=>e(T(false)),onError:a$4,poster:l.banner?l.banner:o.banner,id:"mini-player-video-tag",className:"pl-absolute pl-bg-black pl-w-full pl-h-full",autoPlay:true,muted:true})})},Je=Vt;e();var Rt=()=>{let e=z(),o=A(l=>l.miniPlayer.params);return useEffect(()=>{o.currentTime&&(e(T(true)),y().currentTime=o.currentTime,e(f(false)),x()?.pause());},[o.currentTime]),jsx("video",{poster:o.banner,onPlay:()=>e(T(true)),onEnded:()=>e(T(false)),onError:a$4,src:o.id,id:"mini-player-video-tag",className:"pl-absolute pl-bg-black pl-w-full pl-h-full",autoPlay:true})},Qe=Rt;var $t=()=>{let e=A(o=>o.miniPlayer.params.type);return jsx(Fragment,{children:e==="static"?jsx(Qe,{}):jsx(Je,{})})},We=$t;var Ye=({params:e})=>{let o=z(),l=A(u=>u.miniPlayer.details),a=A(u=>u.miniPlayer.params);A(u=>u.miniPlayer.play);let w=A(u=>u.videoData.params);useEffect(()=>{o(R(e));},[]);let v=async()=>await a$3(e.id);return useEffect(()=>{e.id&&e.type==="vod"&&v();},[e.id]),jsx(Fragment,{children:l.stream_link||a.type==="static"&&a.id?jsxs("div",{style:{zIndex:1003},className:"pl-relative pl-w-full pl-h-full",children:[jsx("div",{className:"pl-absolute pl-z-[1000] pl-top-3 pl-right-3 pl-cursor-pointer",onClick:()=>{w.id===a.id&&(x().currentTime=y().currentTime,o(h(y().currentTime))),localStorage.setItem("close-miniPlayer","true"),e.onClose();},children:jsx(B,{className:"pl-cursor-pointer",src:a$1.closeSquare,alt:"close-square",width:16,height:16})}),jsx("div",{className:"pl-w-full pl-absolute pl-bottom-0 pl-z-[1000000]",children:jsx("div",{className:"pl-w-full pl-flex pl-justify-center",children:jsx(Oe,{})})}),jsx(We,{})]}):jsx("div",{className:"pl-w-full pl-h-full pl-bg-white"})})};var Jt=({params:e})=>{let[o,l]=useState(false);return useEffect(()=>{l(true);},[]),o?jsx(Provider,{store:Aa,children:jsx(J,{children:jsx(Ye,{params:e})})}):null};export{Jt as MiniPlayerLibrary,Nt as VideoPlayerLibrary};//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkQM3W7EYS_js=require('./chunk-QM3W7EYS.js'),chunkDJ6KVZRK_js=require('./chunk-DJ6KVZRK.js'),chunkAK5TFAW3_js=require('./chunk-AK5TFAW3.js'),chunkZWGZGWEB_js=require('./chunk-ZWGZGWEB.js');require('./chunk-BFE2RKVK.js');var chunkU3VFRU6R_js=require('./chunk-U3VFRU6R.js'),chunkAN6JAJSI_js=require('./chunk-AN6JAJSI.js'),u=require('hls.js'),react=require('react'),reactRedux=require('react-redux'),Qe=require('next/image'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var u__default=/*#__PURE__*/_interopDefault(u);var Qe__default=/*#__PURE__*/_interopDefault(Qe);chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();var Ue=()=>{let a=null,{isEnded:r}=chunkAN6JAJSI_js.A(({controller:{isEnded:y}})=>({isEnded:y}),reactRedux.shallowEqual);react.useEffect(()=>(a=setInterval(()=>chunkZWGZGWEB_js.a(),chunkAK5TFAW3_js.c),()=>clearInterval(a)),[]),react.useEffect(()=>{chunkU3VFRU6R_js.t("isEnded")&&clearInterval(a);},[r]);},he=Ue;chunkAN6JAJSI_js.e();var Me=a=>{let[r,y]=react.useState([]),[s,c]=react.useState(0),{qualityLevels:i}=chunkAN6JAJSI_js.A(({controller:{qualityLevels:n}})=>({qualityLevels:n}),reactRedux.shallowEqual);react.useEffect(()=>{if(a){let n=[];switch(r.length){case 0:n=[a];break;case 1:n=[a,...r];break;case 2:n=[a,...r],chunkU3VFRU6R_js.w(chunkU3VFRU6R_js.I(`${n[0]}P`,`${n[1]}P`,i.indexOf(n[0])-i.indexOf(n[1])));break;default:n=[a,r[0],r[1]],n[1]!==n[2]&&chunkU3VFRU6R_js.w(chunkU3VFRU6R_js.I(`${n[1]}P`,`${n[2]}P`,i.indexOf(n[1])-i.indexOf(n[2])));break}y(n);}},[a]),react.useEffect(()=>{r.length===3&&r[0]===r[2]?(chunkU3VFRU6R_js.w(chunkU3VFRU6R_js.J(s,r)),y([]),c(0)):c(new Date().getTime());},[r]);},be=Me;chunkAN6JAJSI_js.e();var _e=()=>{react.useEffect(()=>{let a=()=>{chunkZWGZGWEB_js.a();};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[]);},Le=_e;var $e=()=>{let[a,r]=react.useState(void 0),y=chunkAN6JAJSI_js.z(),{params:s,details:c,videoElementSizeInfo:i}=chunkAN6JAJSI_js.A(({videoData:{params:e,details:o,videoElementSizeInfo:E}})=>({params:e,details:o,videoElementSizeInfo:E}),reactRedux.shallowEqual),{currentTime:n,duration:Se}=chunkAN6JAJSI_js.A(({controller:{currentTime:e,duration:o,isEnded:E,firstPlay:w}})=>({currentTime:e,duration:o,isEnded:E,firstPlay:w}),reactRedux.shallowEqual),P=react.useRef(null),b=react.useRef(null),Te=react.useRef(0),L=react.useRef(0),R=react.useRef(0),V=react.useRef(0),C=react.useRef(0),Re=react.useRef(1),Ve=react.useRef(P.current?.currentTime||0);he(),Le();let v=c.stream_link||s.stream_link;return react.useEffect(()=>{let e=P.current;if(!e||!v)return;chunkU3VFRU6R_js.qa(C),R.current=Date.now(),chunkU3VFRU6R_js.xa(e);let o=new u__default.default(chunkDJ6KVZRK_js.c()),E=()=>o.loadSource(v),w=(t,p)=>chunkDJ6KVZRK_js.e(o,p),Ce=()=>chunkDJ6KVZRK_js.f(o,e),Ie=(t,p)=>chunkDJ6KVZRK_js.g(o,p,r),De=(t,p)=>chunkDJ6KVZRK_js.h(o,p,r),ke=(t,p)=>chunkDJ6KVZRK_js.i(p),I=t=>chunkDJ6KVZRK_js.j(t,L),D=t=>chunkDJ6KVZRK_js.k(t,L),k=t=>chunkDJ6KVZRK_js.l(t,b,e),Fe=t=>chunkDJ6KVZRK_js.r(t,b),F=t=>chunkDJ6KVZRK_js.n(t),x=t=>chunkDJ6KVZRK_js.o(t),H=()=>chunkDJ6KVZRK_js.p(e),U=t=>chunkDJ6KVZRK_js.q(t,e),B=t=>chunkDJ6KVZRK_js.a(t),M=()=>chunkDJ6KVZRK_js.D(e),O=()=>chunkDJ6KVZRK_js.m(Re,C,R,V,b,Te,L,Ve,e);return u__default.default.isSupported()?(o.on(u__default.default.Events.MEDIA_ATTACHED,E),o.on(u__default.default.Events.MANIFEST_PARSED,w),o.on(u__default.default.Events.FRAG_BUFFERED,Ce),o.on(u__default.default.Events.FRAG_CHANGED,Ie),o.on(u__default.default.Events.FRAG_PARSED,De),o.on(u__default.default.Events.ERROR,ke),o.attachMedia(e)):e.canPlayType("application/vnd.apple.mpegurl")&&(e.src=v,chunkDJ6KVZRK_js.b(),e.addEventListener("play",Fe),e.addEventListener("playing",chunkDJ6KVZRK_js.s),e.addEventListener("timeupdate",chunkDJ6KVZRK_js.t),e.addEventListener("ended",chunkDJ6KVZRK_js.u)),e.addEventListener("waiting",I),e.addEventListener("seeking",D),e.addEventListener("play",k),e.addEventListener("playing",O),e.addEventListener("pause",F),e.addEventListener("timeupdate",x),e.addEventListener("canplay",H),e.addEventListener("ended",U),e.addEventListener("error",B),document.addEventListener("visibilitychange",M),()=>{o.destroy(),e.removeEventListener("waiting",I),e.removeEventListener("seeking",D),e.removeEventListener("play",k),e.removeEventListener("playing",O),e.removeEventListener("pause",F),e.removeEventListener("timeupdate",x),e.removeEventListener("canplay",H),e.removeEventListener("ended",U),e.removeEventListener("error",B),document.removeEventListener("visibilitychange",M);}},[v]),react.useEffect(()=>{n<Se&&chunkU3VFRU6R_js.t("isEnded")&&y(chunkAN6JAJSI_js.u(false));},[n]),be(a),chunkQM3W7EYS_js.a(),chunkQM3W7EYS_js.c(),chunkQM3W7EYS_js.b(),chunkQM3W7EYS_js.d(),jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("video",{ref:P,playsInline:true,id:"player-tag",preload:"metadata",crossOrigin:"anonymous",poster:s.banner?s.banner:c.banner,autoPlay:!!chunkU3VFRU6R_js.t("hasAutoPlay")||!!s.advertisement,className:`pl-items-center pl-flex-1 pl-h-full ${!chunkU3VFRU6R_js.t("isTouchScreen")&&!chunkU3VFRU6R_js.t("isFullScreen")&&"!pl-rounded-[12px]"}`,style:{width:"100%",height:"100%",maxWidth:i.width?i.width:"100%",maxHeight:i.width?i.width<i.height?i.width*9/16:i.width*16/9:"100%"},children:jsxRuntime.jsx(Qe__default.default,{fill:true,style:{objectFit:"cover"},src:s.banner?s.banner:c.banner,onLoad:()=>V.current=Date.now(),alt:s.bannerAlt?s.bannerAlt:chunkU3VFRU6R_js.t("isStaticFormat")?"\u0628\u0646\u0631 \u0648\u06CC\u062F\u06CC\u0648 \u067E\u0644\u06CC\u0631 \u06A9\u0627\u0641\u0647 \u0648\u06CC\u062F\u06CC\u0648":c.title??""})})})},In=$e;module.exports=In;//# sourceMappingURL=nonStaticVideoTag-6OHMSJEH.js.map
2
- //# sourceMappingURL=nonStaticVideoTag-6OHMSJEH.js.map
1
+ 'use strict';var chunkKSZ35TPK_js=require('./chunk-KSZ35TPK.js'),chunkHZASW2B2_js=require('./chunk-HZASW2B2.js'),chunkAK5TFAW3_js=require('./chunk-AK5TFAW3.js'),chunk3TPEXSZV_js=require('./chunk-3TPEXSZV.js');require('./chunk-5UGSCO4K.js');var chunkVUHZVVMS_js=require('./chunk-VUHZVVMS.js'),chunkAN6JAJSI_js=require('./chunk-AN6JAJSI.js'),u=require('hls.js'),react=require('react'),reactRedux=require('react-redux'),Qe=require('next/image'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var u__default=/*#__PURE__*/_interopDefault(u);var Qe__default=/*#__PURE__*/_interopDefault(Qe);chunkAN6JAJSI_js.e();chunkAN6JAJSI_js.e();var Ue=()=>{let a=null,{isEnded:r}=chunkAN6JAJSI_js.A(({controller:{isEnded:y}})=>({isEnded:y}),reactRedux.shallowEqual);react.useEffect(()=>(a=setInterval(()=>chunk3TPEXSZV_js.a(),chunkAK5TFAW3_js.c),()=>clearInterval(a)),[]),react.useEffect(()=>{chunkVUHZVVMS_js.t("isEnded")&&clearInterval(a);},[r]);},he=Ue;chunkAN6JAJSI_js.e();var Me=a=>{let[r,y]=react.useState([]),[s,c]=react.useState(0),{qualityLevels:i}=chunkAN6JAJSI_js.A(({controller:{qualityLevels:n}})=>({qualityLevels:n}),reactRedux.shallowEqual);react.useEffect(()=>{if(a){let n=[];switch(r.length){case 0:n=[a];break;case 1:n=[a,...r];break;case 2:n=[a,...r],chunkVUHZVVMS_js.w(chunkVUHZVVMS_js.I(`${n[0]}P`,`${n[1]}P`,i.indexOf(n[0])-i.indexOf(n[1])));break;default:n=[a,r[0],r[1]],n[1]!==n[2]&&chunkVUHZVVMS_js.w(chunkVUHZVVMS_js.I(`${n[1]}P`,`${n[2]}P`,i.indexOf(n[1])-i.indexOf(n[2])));break}y(n);}},[a]),react.useEffect(()=>{r.length===3&&r[0]===r[2]?(chunkVUHZVVMS_js.w(chunkVUHZVVMS_js.J(s,r)),y([]),c(0)):c(new Date().getTime());},[r]);},be=Me;chunkAN6JAJSI_js.e();var _e=()=>{react.useEffect(()=>{let a=()=>{chunk3TPEXSZV_js.a();};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[]);},Le=_e;var $e=()=>{let[a,r]=react.useState(void 0),y=chunkAN6JAJSI_js.z(),{params:s,details:c,videoElementSizeInfo:i}=chunkAN6JAJSI_js.A(({videoData:{params:e,details:o,videoElementSizeInfo:E}})=>({params:e,details:o,videoElementSizeInfo:E}),reactRedux.shallowEqual),{currentTime:n,duration:Se}=chunkAN6JAJSI_js.A(({controller:{currentTime:e,duration:o,isEnded:E,firstPlay:w}})=>({currentTime:e,duration:o,isEnded:E,firstPlay:w}),reactRedux.shallowEqual),P=react.useRef(null),b=react.useRef(null),Te=react.useRef(0),L=react.useRef(0),R=react.useRef(0),V=react.useRef(0),C=react.useRef(0),Re=react.useRef(1),Ve=react.useRef(P.current?.currentTime||0);he(),Le();let v=c.stream_link||s.stream_link;return react.useEffect(()=>{let e=P.current;if(!e||!v)return;chunkVUHZVVMS_js.qa(C),R.current=Date.now(),chunkVUHZVVMS_js.xa(e);let o=new u__default.default(chunkHZASW2B2_js.c()),E=()=>o.loadSource(v),w=(t,p)=>chunkHZASW2B2_js.e(o,p),Ce=()=>chunkHZASW2B2_js.f(o,e),Ie=(t,p)=>chunkHZASW2B2_js.g(o,p,r),De=(t,p)=>chunkHZASW2B2_js.h(o,p,r),ke=(t,p)=>chunkHZASW2B2_js.i(p),I=t=>chunkHZASW2B2_js.j(t,L),D=t=>chunkHZASW2B2_js.k(t,L),k=t=>chunkHZASW2B2_js.l(t,b,e),Fe=t=>chunkHZASW2B2_js.r(t,b),F=t=>chunkHZASW2B2_js.n(t),x=t=>chunkHZASW2B2_js.o(t),H=()=>chunkHZASW2B2_js.p(e),U=t=>chunkHZASW2B2_js.q(t,e),B=t=>chunkHZASW2B2_js.a(t),M=()=>chunkHZASW2B2_js.D(e),O=()=>chunkHZASW2B2_js.m(Re,C,R,V,b,Te,L,Ve,e);return u__default.default.isSupported()?(o.on(u__default.default.Events.MEDIA_ATTACHED,E),o.on(u__default.default.Events.MANIFEST_PARSED,w),o.on(u__default.default.Events.FRAG_BUFFERED,Ce),o.on(u__default.default.Events.FRAG_CHANGED,Ie),o.on(u__default.default.Events.FRAG_PARSED,De),o.on(u__default.default.Events.ERROR,ke),o.attachMedia(e)):e.canPlayType("application/vnd.apple.mpegurl")&&(e.src=v,chunkHZASW2B2_js.b(),e.addEventListener("play",Fe),e.addEventListener("playing",chunkHZASW2B2_js.s),e.addEventListener("timeupdate",chunkHZASW2B2_js.t),e.addEventListener("ended",chunkHZASW2B2_js.u)),e.addEventListener("waiting",I),e.addEventListener("seeking",D),e.addEventListener("play",k),e.addEventListener("playing",O),e.addEventListener("pause",F),e.addEventListener("timeupdate",x),e.addEventListener("canplay",H),e.addEventListener("ended",U),e.addEventListener("error",B),document.addEventListener("visibilitychange",M),()=>{o.destroy(),e.removeEventListener("waiting",I),e.removeEventListener("seeking",D),e.removeEventListener("play",k),e.removeEventListener("playing",O),e.removeEventListener("pause",F),e.removeEventListener("timeupdate",x),e.removeEventListener("canplay",H),e.removeEventListener("ended",U),e.removeEventListener("error",B),document.removeEventListener("visibilitychange",M);}},[v]),react.useEffect(()=>{n<Se&&chunkVUHZVVMS_js.t("isEnded")&&y(chunkAN6JAJSI_js.u(false));},[n]),be(a),chunkKSZ35TPK_js.a(),chunkKSZ35TPK_js.c(),chunkKSZ35TPK_js.b(),chunkKSZ35TPK_js.d(),jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("video",{ref:P,playsInline:true,id:"player-tag",preload:"metadata",crossOrigin:"anonymous",poster:s.banner?s.banner:c.banner,autoPlay:!!chunkVUHZVVMS_js.t("hasAutoPlay")||!!s.advertisement,className:`pl-items-center pl-flex-1 pl-h-full ${!chunkVUHZVVMS_js.t("isTouchScreen")&&!chunkVUHZVVMS_js.t("isFullScreen")&&"!pl-rounded-[12px]"}`,style:{width:"100%",height:"100%",maxWidth:i.width?i.width:"100%",maxHeight:i.width?i.width<i.height?i.width*9/16:i.width*16/9:"100%"},children:jsxRuntime.jsx(Qe__default.default,{fill:true,style:{objectFit:"cover"},src:s.banner?s.banner:c.banner,onLoad:()=>V.current=Date.now(),alt:s.bannerAlt?s.bannerAlt:chunkVUHZVVMS_js.t("isStaticFormat")?"\u0628\u0646\u0631 \u0648\u06CC\u062F\u06CC\u0648 \u067E\u0644\u06CC\u0631 \u06A9\u0627\u0641\u0647 \u0648\u06CC\u062F\u06CC\u0648":c.title??""})})})},In=$e;module.exports=In;//# sourceMappingURL=nonStaticVideoTag-5HEUBWAN.js.map
2
+ //# sourceMappingURL=nonStaticVideoTag-5HEUBWAN.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/videoPlayerLibrary/components/custom-components/videoTag/nonStaticVideoTag.tsx","../src/videoPlayerLibrary/helpers/hooks/useContinuousPlaybackInterval.tsx","../src/videoPlayerLibrary/helpers/hooks/usePingPong.tsx","../src/videoPlayerLibrary/helpers/hooks/useBeforeUnload.tsx"],"names":["init_cjs_shims","useContinuousPlaybackInterval","interval","isEnded","useAppSelector","shallowEqual","useEffect","handleContinuousPlayback","continuousePlaybackIntervalTime","conditions","useContinuousPlaybackInterval_default","usePingPong","qualityLevel","qualityHistory","setQualityHistory","useState","startTimer","setStartTimer","qualityLevels","newQualityArray","sendFluentLog","autoQualityChangeLog","pingpongLog","usePingPong_default","useBeforeUnload","handleBeforeUnload","useBeforeUnload_default","NonStaticVideoTag","setQualityLevel","dispatch","useAppDispatch","params","details","videoElementSizeInfo","currentTime","duration","firstPlay","videoRef","useRef","timerRef","waitingDurationRef","waitingTimerRef","initialWaitingDurationRef","bannerLoadingDurationRef","loadingDurationRef","loadingCounterRef","videoEntranceTimeRef","streamUrl","video","handlePageLoadTime","setupAutoplayBehavior","hls","Hls","handleHlsConfig","onMediaAttached","onManifestParsed","e","data","handleManifestParsed","onFragBuffered","handleFragBuffered","onFragChanged","handleFragChanged","onFragParsed","handleFragParsed","onError","handleHlsErrors","onWaiting","handleVideoWaiting","onSeeking","handleVideoSeeking","onPlay","handleVideoPlay","onIosPlay","handleIosVideoPlay","onPause","handleVideoPause","onTimeUpdate","handleVideoTimeUpdate","onCanPlay","handleVideoCanPlay","onEnded","handleVideoEnded","onVideoError","handleVideoError","onVisibilitychange","handleVideoVisibilityChange","onPlaying","handleVideoPlaying","appendQueryParamsToChunksIOS","handleIosVideoPlaying","handleIosVideoTimeUpdate","handleIosVideoEnded","setIsEnded","useJumpToCurrentTime_default","useAppendSubtitle_default","useHideSubtitle_default","useActiveSubtitleAutomatic_default","jsx","Fragment","Image","nonStaticVideoTag_default"],"mappings":"moBAAAA,kBAAAA,EAAAA,CCAAA,kBAAAA,EAAAA,CAQA,IAAMC,EAAAA,CAAgC,IAAM,CACxC,IAAIC,CAAAA,CAAgB,IAAA,CAEd,CAAE,OAAA,CAAAC,CAAQ,EAAIC,kBAAAA,CAAe,CAAC,CAAE,UAAA,CAAY,CAAE,OAAA,CAAAD,CAAQ,CAAE,CAAA,IAAO,CAAE,OAAA,CAAAA,CAAQ,CAAA,CAAA,CAAIE,uBAAY,CAAA,CAG/FC,eAAAA,CAAU,KACNJ,CAAAA,CAAW,WAAA,CAAY,IAAMK,kBAAAA,GAA4BC,kBAA+B,CAAA,CACjF,IAAM,aAAA,CAAcN,CAAQ,CAAA,CAAA,CACpC,EAAE,CAAA,CAGLI,eAAAA,CAAU,IAAM,CACRG,k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K,oBACzF,CAAA,CAAA,CACA,KAAA,CAAO,CACL,KAAA,CAAO,MAAA,CACP,MAAA,CAAQ,MAAA,CACR,QAAA,CAAUwB,CAAAA,CAAqB,KAAA,CAAQA,CAAAA,CAAqB,KAAA,CAAQ,MAAA,CACpE,UAAWA,CAAAA,CAAqB,KAAA,CAC5BA,CAAAA,CAAqB,KAAA,CAAQA,CAAAA,CAAqB,MAAA,CAC/CA,EAAqB,KAAA,CAAQ,CAAA,CAAK,EAAA,CAClCA,CAAAA,CAAqB,KAAA,CAAQ,EAAA,CAAM,EACtC,MACN,CAAA,CAEA,QAAA,CAAAiE,cAAAA,CAACE,mBAAAA,CAAA,CACC,IAAA,CAAI,IAAA,CACJ,KAAA,CAAO,CAAE,SAAA,CAAW,OAAQ,CAAA,CAC5B,GAAA,CAAKrE,EAAO,MAAA,CAASA,CAAAA,CAAO,MAAA,CAASC,CAAAA,CAAQ,MAAA,CAC7C,MAAA,CAAQ,IAAOW,CAAAA,CAAyB,OAAA,CAAU,IAAA,CAAK,GAAA,EAAI,CAC3D,GAAA,CAAKZ,CAAAA,CAAO,UAAYA,CAAAA,CAAO,SAAA,CAAYtB,kBAAAA,CAAAA,gBAAuC,CAAA,CAAI,oIAAA,CAA+BuB,CAAAA,CAAQ,KAAA,EAAS,EAAA,CACxI,CAAA,CACF,CAAA,CACF,CAEJ,CAAA,CAEOqE,EAAAA,CAAQ1E","file":"nonStaticVideoTag-6OHMSJEH.js","sourcesContent":["\"use client\";\r\n\r\nimport Hls, { ErrorData } from \"hls.js\";\r\nimport { useEffect, useState, useRef } from \"react\";\r\nimport { shallowEqual } from \"react-redux\";\r\nimport { useAppDispatch, useAppSelector } from \"../../../helpers/redux/hooks\";\r\nimport useContinuousPlaybackInterval from \"../../../helpers/hooks/useContinuousPlaybackInterval\";\r\nimport { handlePageLoadTime, setupAutoplayBehavior } from \"../../../helpers/helpers\";\r\nimport {\r\n appendQueryParamsToChunksIOS,\r\n handleFragBuffered,\r\n handleFragChanged,\r\n handleFragParsed,\r\n handleHlsConfig,\r\n handleHlsErrors,\r\n handleIosVideoEnded,\r\n handleIosVideoPlay,\r\n handleIosVideoPlaying,\r\n handleIosVideoTimeUpdate,\r\n handleManifestParsed,\r\n handleVideoCanPlay,\r\n handleVideoEnded,\r\n handleVideoError,\r\n handleVideoPause,\r\n handleVideoPlay,\r\n handleVideoPlaying,\r\n handleVideoSeeking,\r\n handleVideoTimeUpdate,\r\n handleVideoVisibilityChange,\r\n handleVideoWaiting,\r\n} from \"../../../helpers/redux/actions/playerCore.actions\";\r\nimport { ConditionName } from \"../../../helpers/interfaces/enums\";\r\nimport { conditions } from \"../../../helpers/conditions/conditions\";\r\nimport { setIsEnded } from \"../../../helpers/redux/slices/controllerSlice\";\r\nimport usePingPong from \"../../../helpers/hooks/usePingPong\";\r\nimport useBeforeUnload from \"../../../helpers/hooks/useBeforeUnload\";\r\nimport useHideSubtitle from \"../../../helpers/hooks/useHideSubtitle\";\r\nimport useJumpToCurrentTime from \"../../../helpers/hooks/useJumpToCurrentTime\";\r\nimport useAppendSubtitle from \"../../../helpers/hooks/useAppendSubtitle\";\r\nimport useActiveSubtitleAutomatic from \"../../../helpers/hooks/useActiveSubtitleAutomatic\";\r\nimport Image from \"next/image\";\r\n\r\nconst NonStaticVideoTag = () => {\r\n const [qualityLevel, setQualityLevel] = useState<number | undefined>(undefined);\r\n\r\n const dispatch = useAppDispatch();\r\n const { params, details, videoElementSizeInfo } = useAppSelector(\r\n ({ videoData: { params, details, videoElementSizeInfo } }) => ({\r\n params,\r\n details,\r\n videoElementSizeInfo,\r\n }),\r\n shallowEqual,\r\n );\r\n const { currentTime, duration } = useAppSelector(\r\n ({ controller: { currentTime, duration, isEnded, firstPlay } }) => ({\r\n currentTime,\r\n duration,\r\n isEnded,\r\n firstPlay,\r\n }),\r\n shallowEqual,\r\n );\r\n\r\n const videoRef = useRef<HTMLVideoElement | null>(null);\r\n const timerRef = useRef<any>(null);\r\n const waitingDurationRef = useRef<any>(0);\r\n const waitingTimerRef = useRef<number>(0);\r\n const initialWaitingDurationRef = useRef<any>(0);\r\n const bannerLoadingDurationRef = useRef<any>(0);\r\n const loadingDurationRef = useRef<any>(0);\r\n const loadingCounterRef = useRef<any>(1);\r\n const videoEntranceTimeRef = useRef<any>(videoRef.current?.currentTime || 0);\r\n\r\n useContinuousPlaybackInterval();\r\n useBeforeUnload();\r\n\r\n const streamUrl = details.stream_link || params.stream_link;\r\n\r\n useEffect(() => {\r\n const video = videoRef.current;\r\n\r\n if (!video || !streamUrl) return;\r\n\r\n // ---- Page Load Time ----\r\n handlePageLoadTime(loadingDurationRef);\r\n initialWaitingDurationRef.current = Date.now();\r\n setupAutoplayBehavior(video);\r\n\r\n const hls = new Hls(handleHlsConfig());\r\n // ---------------- HLS EVENTS ----------------\r\n const onMediaAttached = () => hls.loadSource(streamUrl);\r\n const onManifestParsed = (e: any, data: any) => handleManifestParsed(hls, data);\r\n const onFragBuffered = () => handleFragBuffered(hls, video);\r\n const onFragChanged = (e: any, data: any) => handleFragChanged(hls, data, setQualityLevel);\r\n const onFragParsed = (e: any, data: any) => handleFragParsed(hls, data, setQualityLevel);\r\n const onError = (e: any, data: ErrorData) => handleHlsErrors(data);\r\n\r\n // ---------------- VIDEO EVENTS ----------------\r\n const onWaiting = (e: any) => handleVideoWaiting(e, waitingTimerRef);\r\n const onSeeking = (e: any) => handleVideoSeeking(e, waitingTimerRef);\r\n const onPlay = (e: any) => handleVideoPlay(e, timerRef, video);\r\n const onIosPlay = (e: any) => handleIosVideoPlay(e, timerRef);\r\n const onPause = (e: any) => handleVideoPause(e);\r\n const onTimeUpdate = (e: any) => handleVideoTimeUpdate(e);\r\n const onCanPlay = () => handleVideoCanPlay(video);\r\n const onEnded = (e: any) => handleVideoEnded(e, video);\r\n const onVideoError = (e: any) => handleVideoError(e);\r\n const onVisibilitychange = () => handleVideoVisibilityChange(video);\r\n const onPlaying = () =>\r\n handleVideoPlaying(\r\n loadingCounterRef,\r\n loadingDurationRef,\r\n initialWaitingDurationRef,\r\n bannerLoadingDurationRef,\r\n timerRef,\r\n waitingDurationRef,\r\n waitingTimerRef,\r\n videoEntranceTimeRef,\r\n video,\r\n );\r\n\r\n // ---------------- INIT ----------------\r\n if (Hls.isSupported()) {\r\n hls.on(Hls.Events.MEDIA_ATTACHED, onMediaAttached);\r\n hls.on(Hls.Events.MANIFEST_PARSED, onManifestParsed);\r\n hls.on(Hls.Events.FRAG_BUFFERED, onFragBuffered);\r\n hls.on(Hls.Events.FRAG_CHANGED, onFragChanged);\r\n hls.on(Hls.Events.FRAG_PARSED, onFragParsed);\r\n hls.on(Hls.Events.ERROR, onError);\r\n\r\n hls.attachMedia(video);\r\n } else if (video.canPlayType(\"application/vnd.apple.mpegurl\")) {\r\n video.src = streamUrl;\r\n appendQueryParamsToChunksIOS();\r\n\r\n video.addEventListener(\"play\", onIosPlay);\r\n video.addEventListener(\"playing\", handleIosVideoPlaying);\r\n video.addEventListener(\"timeupdate\", handleIosVideoTimeUpdate);\r\n video.addEventListener(\"ended\", handleIosVideoEnded);\r\n }\r\n\r\n video.addEventListener(\"waiting\", onWaiting);\r\n video.addEventListener(\"seeking\", onSeeking);\r\n video.addEventListener(\"play\", onPlay);\r\n video.addEventListener(\"playing\", onPlaying);\r\n video.addEventListener(\"pause\", onPause);\r\n video.addEventListener(\"timeupdate\", onTimeUpdate);\r\n video.addEventListener(\"canplay\", onCanPlay);\r\n video.addEventListener(\"ended\", onEnded);\r\n video.addEventListener(\"error\", onVideoError);\r\n\r\n document.addEventListener(\"visibilitychange\", onVisibilitychange);\r\n\r\n // ---------------- CLEANUP ----------------\r\n return () => {\r\n hls.destroy();\r\n\r\n video.removeEventListener(\"waiting\", onWaiting);\r\n video.removeEventListener(\"seeking\", onSeeking);\r\n video.removeEventListener(\"play\", onPlay);\r\n video.removeEventListener(\"playing\", onPlaying);\r\n video.removeEventListener(\"pause\", onPause);\r\n video.removeEventListener(\"timeupdate\", onTimeUpdate);\r\n video.removeEventListener(\"canplay\", onCanPlay);\r\n video.removeEventListener(\"ended\", onEnded);\r\n video.removeEventListener(\"error\", onVideoError);\r\n\r\n document.removeEventListener(\"visibilitychange\", onVisibilitychange);\r\n };\r\n }, [streamUrl]);\r\n\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n useEffect(() => {\r\n if (currentTime < duration && conditions(ConditionName.isEnded)) dispatch(setIsEnded(false));\r\n }, [currentTime]);\r\n\r\n usePingPong(qualityLevel);\r\n\r\n useJumpToCurrentTime();\r\n useAppendSubtitle();\r\n useHideSubtitle();\r\n useActiveSubtitleAutomatic();\r\n\r\n return (\r\n <>\r\n <video\r\n ref={videoRef}\r\n playsInline\r\n id=\"player-tag\"\r\n preload=\"metadata\"\r\n crossOrigin=\"anonymous\"\r\n poster={params.banner ? params.banner : details.banner}\r\n autoPlay={!!conditions(ConditionName.hasAutoPlay) || !!params.advertisement}\r\n className={`pl-items-center pl-flex-1 pl-h-full ${\r\n !conditions(ConditionName.isTouchScreen) && !conditions(ConditionName.isFullScreen) && \"!pl-rounded-[12px]\"\r\n }`}\r\n style={{\r\n width: \"100%\",\r\n height: \"100%\",\r\n maxWidth: videoElementSizeInfo.width ? videoElementSizeInfo.width : \"100%\",\r\n maxHeight: videoElementSizeInfo.width\r\n ? videoElementSizeInfo.width < videoElementSizeInfo.height\r\n ? (videoElementSizeInfo.width * 9) / 16\r\n : (videoElementSizeInfo.width * 16) / 9\r\n : \"100%\",\r\n }}\r\n >\r\n <Image\r\n fill\r\n style={{ objectFit: \"cover\" }}\r\n src={params.banner ? params.banner : details.banner}\r\n onLoad={() => (bannerLoadingDurationRef.current = Date.now())}\r\n alt={params.bannerAlt ? params.bannerAlt : conditions(ConditionName.isStaticFormat) ? \"بنر ویدیو پلیر کافه ویدیو\" : (details.title ?? \"\")}\r\n />\r\n </video>\r\n </>\r\n );\r\n};\r\n\r\nexport default NonStaticVideoTag;\r\n","import { useEffect } from \"react\";\nimport { shallowEqual } from \"react-redux\";\nimport { useAppSelector } from \"../redux/hooks\";\nimport { continuousePlaybackIntervalTime } from \"../environment\";\nimport { ConditionName } from \"../interfaces/enums\";\nimport { conditions } from \"../conditions/conditions\";\nimport { handleContinuousPlayback } from \"../redux/actions/user.actions\";\n\nconst useContinuousPlaybackInterval = () => {\n let interval: any = null;\n\n const { isEnded } = useAppSelector(({ controller: { isEnded } }) => ({ isEnded }), shallowEqual);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n interval = setInterval(() => handleContinuousPlayback(), continuousePlaybackIntervalTime);\n return () => clearInterval(interval);\n }, []);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (conditions(ConditionName.isEnded)) clearInterval(interval);\n }, [isEnded]);\n};\n\nexport default useContinuousPlaybackInterval;\n","import { useEffect, useState } from \"react\";\nimport { shallowEqual } from \"react-redux\";\nimport { useAppSelector } from \"../redux/hooks\";\nimport { sendFluentLog } from \"../logs/fluentdLogger\";\nimport { autoQualityChangeLog, pingpongLog } from \"../logs/logs\";\n\nconst usePingPong = (qualityLevel?: number) => {\n const [qualityHistory, setQualityHistory] = useState<number[]>([]);\n const [startTimer, setStartTimer] = useState<number>(0);\n\n const { qualityLevels } = useAppSelector(({ controller: { qualityLevels } }) => ({ qualityLevels }), shallowEqual);\n\n useEffect(() => {\n if (qualityLevel) {\n let newQualityArray: number[] = [];\n switch (qualityHistory.length) {\n case 0:\n newQualityArray = [qualityLevel];\n break;\n case 1:\n newQualityArray = [qualityLevel, ...qualityHistory];\n break;\n case 2:\n newQualityArray = [qualityLevel, ...qualityHistory];\n sendFluentLog(\n autoQualityChangeLog(\n `${newQualityArray[0]}P`,\n `${newQualityArray[1]}P`,\n qualityLevels.indexOf(newQualityArray[0]) - qualityLevels.indexOf(newQualityArray[1])\n )\n );\n break;\n default:\n newQualityArray = [qualityLevel, qualityHistory[0], qualityHistory[1]];\n if (newQualityArray[1] !== newQualityArray[2])\n sendFluentLog(\n autoQualityChangeLog(\n `${newQualityArray[1]}P`,\n `${newQualityArray[2]}P`,\n qualityLevels.indexOf(newQualityArray[1]) - qualityLevels.indexOf(newQualityArray[2])\n )\n );\n break;\n }\n setQualityHistory(newQualityArray);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [qualityLevel]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (qualityHistory.length === 3 && qualityHistory[0] === qualityHistory[2]) {\n sendFluentLog(pingpongLog(startTimer, qualityHistory));\n setQualityHistory([]);\n setStartTimer(0);\n } else {\n setStartTimer(new Date().getTime());\n }\n }, [qualityHistory]);\n};\nexport default usePingPong;\n","import { useEffect } from \"react\";\nimport { handleContinuousPlayback } from \"../redux/actions/user.actions\";\n\nconst useBeforeUnload = () => {\n useEffect(() => {\n const handleBeforeUnload = () => {\n handleContinuousPlayback();\n };\n\n window.addEventListener(\"beforeunload\", handleBeforeUnload);\n return () => window.removeEventListener(\"beforeunload\", handleBeforeUnload);\n }, []);\n};\n\nexport default useBeforeUnload;\n"]}
1
+ {"version":3,"sources":["../src/videoPlayerLibrary/components/custom-components/videoTag/nonStaticVideoTag.tsx","../src/videoPlayerLibrary/helpers/hooks/useContinuousPlaybackInterval.tsx","../src/videoPlayerLibrary/helpers/hooks/usePingPong.tsx","../src/videoPlayerLibrary/helpers/hooks/useBeforeUnload.tsx"],"names":["init_cjs_shims","useContinuousPlaybackInterval","interval","isEnded","useAppSelector","shallowEqual","useEffect","handleContinuousPlayback","continuousePlaybackIntervalTime","conditions","useContinuousPlaybackInterval_default","usePingPong","qualityLevel","qualityHistory","setQualityHistory","useState","startTimer","setStartTimer","qualityLevels","newQualityArray","sendFluentLog","autoQualityChangeLog","pingpongLog","usePingPong_default","useBeforeUnload","handleBeforeUnload","useBeforeUnload_default","NonStaticVideoTag","setQualityLevel","dispatch","useAppDispatch","params","details","videoElementSizeInfo","currentTime","duration","firstPlay","videoRef","useRef","timerRef","waitingDurationRef","waitingTimerRef","initialWaitingDurationRef","bannerLoadingDurationRef","loadingDurationRef","loadingCounterRef","videoEntranceTimeRef","streamUrl","video","handlePageLoadTime","setupAutoplayBehavior","hls","Hls","handleHlsConfig","onMediaAttached","onManifestParsed","e","data","handleManifestParsed","onFragBuffered","handleFragBuffered","onFragChanged","handleFragChanged","onFragParsed","handleFragParsed","onError","handleHlsErrors","onWaiting","handleVideoWaiting","onSeeking","handleVideoSeeking","onPlay","handleVideoPlay","onIosPlay","handleIosVideoPlay","onPause","handleVideoPause","onTimeUpdate","handleVideoTimeUpdate","onCanPlay","handleVideoCanPlay","onEnded","handleVideoEnded","onVideoError","handleVideoError","onVisibilitychange","handleVideoVisibilityChange","onPlaying","handleVideoPlaying","appendQueryParamsToChunksIOS","handleIosVideoPlaying","handleIosVideoTimeUpdate","handleIosVideoEnded","setIsEnded","useJumpToCurrentTime_default","useAppendSubtitle_default","useHideSubtitle_default","useActiveSubtitleAutomatic_default","jsx","Fragment","Image","nonStaticVideoTag_default"],"mappings":"moBAAAA,kBAAAA,EAAAA,CCAAA,kBAAAA,EAAAA,CAQA,IAAMC,EAAAA,CAAgC,IAAM,CACxC,IAAIC,CAAAA,CAAgB,IAAA,CAEd,CAAE,OAAA,CAAAC,CAAQ,EAAIC,kBAAAA,CAAe,CAAC,CAAE,UAAA,CAAY,CAAE,OAAA,CAAAD,CAAQ,CAAE,CAAA,IAAO,CAAE,OAAA,CAAAA,CAAQ,CAAA,CAAA,CAAIE,uBAAY,CAAA,CAG/FC,eAAAA,CAAU,KACNJ,CAAAA,CAAW,WAAA,CAAY,IAAMK,kBAAAA,GAA4BC,kBAA+B,CAAA,CACjF,IAAM,aAAA,CAAcN,CAAQ,CAAA,CAAA,CACpC,EAAE,CAAA,CAGLI,eAAAA,CAAU,IAAM,CACRG,kBAAAA,CAAAA,SAAgC,GAAG,aAAA,CAAcP,CAAQ,EACjE,CAAA,CAAG,CAACC,CAAO,CAAC,EAChB,CAAA,CAEOO,EAAAA,CAAQT,EAAAA,CCzBfD,kBAAAA,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AqB,KAAA,CAAQ,MAAA,CACpE,UAAWA,CAAAA,CAAqB,KAAA,CAC5BA,CAAAA,CAAqB,KAAA,CAAQA,CAAAA,CAAqB,MAAA,CAC/CA,EAAqB,KAAA,CAAQ,CAAA,CAAK,EAAA,CAClCA,CAAAA,CAAqB,KAAA,CAAQ,EAAA,CAAM,EACtC,MACN,CAAA,CAEA,QAAA,CAAAiE,cAAAA,CAACE,mBAAAA,CAAA,CACC,IAAA,CAAI,IAAA,CACJ,KAAA,CAAO,CAAE,SAAA,CAAW,OAAQ,CAAA,CAC5B,GAAA,CAAKrE,EAAO,MAAA,CAASA,CAAAA,CAAO,MAAA,CAASC,CAAAA,CAAQ,MAAA,CAC7C,MAAA,CAAQ,IAAOW,CAAAA,CAAyB,OAAA,CAAU,IAAA,CAAK,GAAA,EAAI,CAC3D,GAAA,CAAKZ,CAAAA,CAAO,UAAYA,CAAAA,CAAO,SAAA,CAAYtB,kBAAAA,CAAAA,gBAAuC,CAAA,CAAI,oIAAA,CAA+BuB,CAAAA,CAAQ,KAAA,EAAS,EAAA,CACxI,CAAA,CACF,CAAA,CACF,CAEJ,CAAA,CAEOqE,EAAAA,CAAQ1E","file":"nonStaticVideoTag-5HEUBWAN.js","sourcesContent":["\"use client\";\r\n\r\nimport Hls, { ErrorData } from \"hls.js\";\r\nimport { useEffect, useState, useRef } from \"react\";\r\nimport { shallowEqual } from \"react-redux\";\r\nimport { useAppDispatch, useAppSelector } from \"../../../helpers/redux/hooks\";\r\nimport useContinuousPlaybackInterval from \"../../../helpers/hooks/useContinuousPlaybackInterval\";\r\nimport { handlePageLoadTime, setupAutoplayBehavior } from \"../../../helpers/helpers\";\r\nimport {\r\n appendQueryParamsToChunksIOS,\r\n handleFragBuffered,\r\n handleFragChanged,\r\n handleFragParsed,\r\n handleHlsConfig,\r\n handleHlsErrors,\r\n handleIosVideoEnded,\r\n handleIosVideoPlay,\r\n handleIosVideoPlaying,\r\n handleIosVideoTimeUpdate,\r\n handleManifestParsed,\r\n handleVideoCanPlay,\r\n handleVideoEnded,\r\n handleVideoError,\r\n handleVideoPause,\r\n handleVideoPlay,\r\n handleVideoPlaying,\r\n handleVideoSeeking,\r\n handleVideoTimeUpdate,\r\n handleVideoVisibilityChange,\r\n handleVideoWaiting,\r\n} from \"../../../helpers/redux/actions/playerCore.actions\";\r\nimport { ConditionName } from \"../../../helpers/interfaces/enums\";\r\nimport { conditions } from \"../../../helpers/conditions/conditions\";\r\nimport { setIsEnded } from \"../../../helpers/redux/slices/controllerSlice\";\r\nimport usePingPong from \"../../../helpers/hooks/usePingPong\";\r\nimport useBeforeUnload from \"../../../helpers/hooks/useBeforeUnload\";\r\nimport useHideSubtitle from \"../../../helpers/hooks/useHideSubtitle\";\r\nimport useJumpToCurrentTime from \"../../../helpers/hooks/useJumpToCurrentTime\";\r\nimport useAppendSubtitle from \"../../../helpers/hooks/useAppendSubtitle\";\r\nimport useActiveSubtitleAutomatic from \"../../../helpers/hooks/useActiveSubtitleAutomatic\";\r\nimport Image from \"next/image\";\r\n\r\nconst NonStaticVideoTag = () => {\r\n const [qualityLevel, setQualityLevel] = useState<number | undefined>(undefined);\r\n\r\n const dispatch = useAppDispatch();\r\n const { params, details, videoElementSizeInfo } = useAppSelector(\r\n ({ videoData: { params, details, videoElementSizeInfo } }) => ({\r\n params,\r\n details,\r\n videoElementSizeInfo,\r\n }),\r\n shallowEqual,\r\n );\r\n const { currentTime, duration } = useAppSelector(\r\n ({ controller: { currentTime, duration, isEnded, firstPlay } }) => ({\r\n currentTime,\r\n duration,\r\n isEnded,\r\n firstPlay,\r\n }),\r\n shallowEqual,\r\n );\r\n\r\n const videoRef = useRef<HTMLVideoElement | null>(null);\r\n const timerRef = useRef<any>(null);\r\n const waitingDurationRef = useRef<any>(0);\r\n const waitingTimerRef = useRef<number>(0);\r\n const initialWaitingDurationRef = useRef<any>(0);\r\n const bannerLoadingDurationRef = useRef<any>(0);\r\n const loadingDurationRef = useRef<any>(0);\r\n const loadingCounterRef = useRef<any>(1);\r\n const videoEntranceTimeRef = useRef<any>(videoRef.current?.currentTime || 0);\r\n\r\n useContinuousPlaybackInterval();\r\n useBeforeUnload();\r\n\r\n const streamUrl = details.stream_link || params.stream_link;\r\n\r\n useEffect(() => {\r\n const video = videoRef.current;\r\n\r\n if (!video || !streamUrl) return;\r\n\r\n // ---- Page Load Time ----\r\n handlePageLoadTime(loadingDurationRef);\r\n initialWaitingDurationRef.current = Date.now();\r\n setupAutoplayBehavior(video);\r\n\r\n const hls = new Hls(handleHlsConfig());\r\n // ---------------- HLS EVENTS ----------------\r\n const onMediaAttached = () => hls.loadSource(streamUrl);\r\n const onManifestParsed = (e: any, data: any) => handleManifestParsed(hls, data);\r\n const onFragBuffered = () => handleFragBuffered(hls, video);\r\n const onFragChanged = (e: any, data: any) => handleFragChanged(hls, data, setQualityLevel);\r\n const onFragParsed = (e: any, data: any) => handleFragParsed(hls, data, setQualityLevel);\r\n const onError = (e: any, data: ErrorData) => handleHlsErrors(data);\r\n\r\n // ---------------- VIDEO EVENTS ----------------\r\n const onWaiting = (e: any) => handleVideoWaiting(e, waitingTimerRef);\r\n const onSeeking = (e: any) => handleVideoSeeking(e, waitingTimerRef);\r\n const onPlay = (e: any) => handleVideoPlay(e, timerRef, video);\r\n const onIosPlay = (e: any) => handleIosVideoPlay(e, timerRef);\r\n const onPause = (e: any) => handleVideoPause(e);\r\n const onTimeUpdate = (e: any) => handleVideoTimeUpdate(e);\r\n const onCanPlay = () => handleVideoCanPlay(video);\r\n const onEnded = (e: any) => handleVideoEnded(e, video);\r\n const onVideoError = (e: any) => handleVideoError(e);\r\n const onVisibilitychange = () => handleVideoVisibilityChange(video);\r\n const onPlaying = () =>\r\n handleVideoPlaying(\r\n loadingCounterRef,\r\n loadingDurationRef,\r\n initialWaitingDurationRef,\r\n bannerLoadingDurationRef,\r\n timerRef,\r\n waitingDurationRef,\r\n waitingTimerRef,\r\n videoEntranceTimeRef,\r\n video,\r\n );\r\n\r\n // ---------------- INIT ----------------\r\n if (Hls.isSupported()) {\r\n hls.on(Hls.Events.MEDIA_ATTACHED, onMediaAttached);\r\n hls.on(Hls.Events.MANIFEST_PARSED, onManifestParsed);\r\n hls.on(Hls.Events.FRAG_BUFFERED, onFragBuffered);\r\n hls.on(Hls.Events.FRAG_CHANGED, onFragChanged);\r\n hls.on(Hls.Events.FRAG_PARSED, onFragParsed);\r\n hls.on(Hls.Events.ERROR, onError);\r\n\r\n hls.attachMedia(video);\r\n } else if (video.canPlayType(\"application/vnd.apple.mpegurl\")) {\r\n video.src = streamUrl;\r\n appendQueryParamsToChunksIOS();\r\n\r\n video.addEventListener(\"play\", onIosPlay);\r\n video.addEventListener(\"playing\", handleIosVideoPlaying);\r\n video.addEventListener(\"timeupdate\", handleIosVideoTimeUpdate);\r\n video.addEventListener(\"ended\", handleIosVideoEnded);\r\n }\r\n\r\n video.addEventListener(\"waiting\", onWaiting);\r\n video.addEventListener(\"seeking\", onSeeking);\r\n video.addEventListener(\"play\", onPlay);\r\n video.addEventListener(\"playing\", onPlaying);\r\n video.addEventListener(\"pause\", onPause);\r\n video.addEventListener(\"timeupdate\", onTimeUpdate);\r\n video.addEventListener(\"canplay\", onCanPlay);\r\n video.addEventListener(\"ended\", onEnded);\r\n video.addEventListener(\"error\", onVideoError);\r\n\r\n document.addEventListener(\"visibilitychange\", onVisibilitychange);\r\n\r\n // ---------------- CLEANUP ----------------\r\n return () => {\r\n hls.destroy();\r\n\r\n video.removeEventListener(\"waiting\", onWaiting);\r\n video.removeEventListener(\"seeking\", onSeeking);\r\n video.removeEventListener(\"play\", onPlay);\r\n video.removeEventListener(\"playing\", onPlaying);\r\n video.removeEventListener(\"pause\", onPause);\r\n video.removeEventListener(\"timeupdate\", onTimeUpdate);\r\n video.removeEventListener(\"canplay\", onCanPlay);\r\n video.removeEventListener(\"ended\", onEnded);\r\n video.removeEventListener(\"error\", onVideoError);\r\n\r\n document.removeEventListener(\"visibilitychange\", onVisibilitychange);\r\n };\r\n }, [streamUrl]);\r\n\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n useEffect(() => {\r\n if (currentTime < duration && conditions(ConditionName.isEnded)) dispatch(setIsEnded(false));\r\n }, [currentTime]);\r\n\r\n usePingPong(qualityLevel);\r\n\r\n useJumpToCurrentTime();\r\n useAppendSubtitle();\r\n useHideSubtitle();\r\n useActiveSubtitleAutomatic();\r\n\r\n return (\r\n <>\r\n <video\r\n ref={videoRef}\r\n playsInline\r\n id=\"player-tag\"\r\n preload=\"metadata\"\r\n crossOrigin=\"anonymous\"\r\n poster={params.banner ? params.banner : details.banner}\r\n autoPlay={!!conditions(ConditionName.hasAutoPlay) || !!params.advertisement}\r\n className={`pl-items-center pl-flex-1 pl-h-full ${\r\n !conditions(ConditionName.isTouchScreen) && !conditions(ConditionName.isFullScreen) && \"!pl-rounded-[12px]\"\r\n }`}\r\n style={{\r\n width: \"100%\",\r\n height: \"100%\",\r\n maxWidth: videoElementSizeInfo.width ? videoElementSizeInfo.width : \"100%\",\r\n maxHeight: videoElementSizeInfo.width\r\n ? videoElementSizeInfo.width < videoElementSizeInfo.height\r\n ? (videoElementSizeInfo.width * 9) / 16\r\n : (videoElementSizeInfo.width * 16) / 9\r\n : \"100%\",\r\n }}\r\n >\r\n <Image\r\n fill\r\n style={{ objectFit: \"cover\" }}\r\n src={params.banner ? params.banner : details.banner}\r\n onLoad={() => (bannerLoadingDurationRef.current = Date.now())}\r\n alt={params.bannerAlt ? params.bannerAlt : conditions(ConditionName.isStaticFormat) ? \"بنر ویدیو پلیر کافه ویدیو\" : (details.title ?? \"\")}\r\n />\r\n </video>\r\n </>\r\n );\r\n};\r\n\r\nexport default NonStaticVideoTag;\r\n","import { useEffect } from \"react\";\nimport { shallowEqual } from \"react-redux\";\nimport { useAppSelector } from \"../redux/hooks\";\nimport { continuousePlaybackIntervalTime } from \"../environment\";\nimport { ConditionName } from \"../interfaces/enums\";\nimport { conditions } from \"../conditions/conditions\";\nimport { handleContinuousPlayback } from \"../redux/actions/user.actions\";\n\nconst useContinuousPlaybackInterval = () => {\n let interval: any = null;\n\n const { isEnded } = useAppSelector(({ controller: { isEnded } }) => ({ isEnded }), shallowEqual);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n interval = setInterval(() => handleContinuousPlayback(), continuousePlaybackIntervalTime);\n return () => clearInterval(interval);\n }, []);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (conditions(ConditionName.isEnded)) clearInterval(interval);\n }, [isEnded]);\n};\n\nexport default useContinuousPlaybackInterval;\n","import { useEffect, useState } from \"react\";\nimport { shallowEqual } from \"react-redux\";\nimport { useAppSelector } from \"../redux/hooks\";\nimport { sendFluentLog } from \"../logs/fluentdLogger\";\nimport { autoQualityChangeLog, pingpongLog } from \"../logs/logs\";\n\nconst usePingPong = (qualityLevel?: number) => {\n const [qualityHistory, setQualityHistory] = useState<number[]>([]);\n const [startTimer, setStartTimer] = useState<number>(0);\n\n const { qualityLevels } = useAppSelector(({ controller: { qualityLevels } }) => ({ qualityLevels }), shallowEqual);\n\n useEffect(() => {\n if (qualityLevel) {\n let newQualityArray: number[] = [];\n switch (qualityHistory.length) {\n case 0:\n newQualityArray = [qualityLevel];\n break;\n case 1:\n newQualityArray = [qualityLevel, ...qualityHistory];\n break;\n case 2:\n newQualityArray = [qualityLevel, ...qualityHistory];\n sendFluentLog(\n autoQualityChangeLog(\n `${newQualityArray[0]}P`,\n `${newQualityArray[1]}P`,\n qualityLevels.indexOf(newQualityArray[0]) - qualityLevels.indexOf(newQualityArray[1])\n )\n );\n break;\n default:\n newQualityArray = [qualityLevel, qualityHistory[0], qualityHistory[1]];\n if (newQualityArray[1] !== newQualityArray[2])\n sendFluentLog(\n autoQualityChangeLog(\n `${newQualityArray[1]}P`,\n `${newQualityArray[2]}P`,\n qualityLevels.indexOf(newQualityArray[1]) - qualityLevels.indexOf(newQualityArray[2])\n )\n );\n break;\n }\n setQualityHistory(newQualityArray);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [qualityLevel]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (qualityHistory.length === 3 && qualityHistory[0] === qualityHistory[2]) {\n sendFluentLog(pingpongLog(startTimer, qualityHistory));\n setQualityHistory([]);\n setStartTimer(0);\n } else {\n setStartTimer(new Date().getTime());\n }\n }, [qualityHistory]);\n};\nexport default usePingPong;\n","import { useEffect } from \"react\";\nimport { handleContinuousPlayback } from \"../redux/actions/user.actions\";\n\nconst useBeforeUnload = () => {\n useEffect(() => {\n const handleBeforeUnload = () => {\n handleContinuousPlayback();\n };\n\n window.addEventListener(\"beforeunload\", handleBeforeUnload);\n return () => window.removeEventListener(\"beforeunload\", handleBeforeUnload);\n }, []);\n};\n\nexport default useBeforeUnload;\n"]}
@@ -1,2 +1,2 @@
1
- import {a,c as c$1,b as b$1,d}from'./chunk-4XKL6TLO.mjs';import {c,b,s,t,u as u$1,e as e$1,f,g,h,i,j,k,l,r,n,o,p,q,a as a$1,D,m}from'./chunk-73KLK4QU.mjs';import {c as c$2}from'./chunk-2DV7FRU5.mjs';import {a as a$2}from'./chunk-PKXJEXKI.mjs';import'./chunk-CCO6GDG2.mjs';import {qa,xa,t as t$1,w,I,J}from'./chunk-BC4366GN.mjs';import {e,z,A,u as u$2}from'./chunk-4QMWBTB5.mjs';import u from'hls.js';import {useState,useRef,useEffect}from'react';import {shallowEqual}from'react-redux';import $e from'next/image';import {jsx,Fragment}from'react/jsx-runtime';e();e();var Be=()=>{let a=null,{isEnded:r}=A(({controller:{isEnded:y}})=>({isEnded:y}),shallowEqual);useEffect(()=>(a=setInterval(()=>a$2(),c$2),()=>clearInterval(a)),[]),useEffect(()=>{t$1("isEnded")&&clearInterval(a);},[r]);},ge=Be;e();var Oe=a=>{let[r,y]=useState([]),[s,c]=useState(0),{qualityLevels:i}=A(({controller:{qualityLevels:n}})=>({qualityLevels:n}),shallowEqual);useEffect(()=>{if(a){let n=[];switch(r.length){case 0:n=[a];break;case 1:n=[a,...r];break;case 2:n=[a,...r],w(I(`${n[0]}P`,`${n[1]}P`,i.indexOf(n[0])-i.indexOf(n[1])));break;default:n=[a,r[0],r[1]],n[1]!==n[2]&&w(I(`${n[1]}P`,`${n[2]}P`,i.indexOf(n[1])-i.indexOf(n[2])));break}y(n);}},[a]),useEffect(()=>{r.length===3&&r[0]===r[2]?(w(J(s,r)),y([]),c(0)):c(new Date().getTime());},[r]);},Le=Oe;e();var Ne=()=>{useEffect(()=>{let a=()=>{a$2();};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[]);},we=Ne;var Ge=()=>{let[a$2,r$1]=useState(void 0),y=z(),{params:s$1,details:c$2,videoElementSizeInfo:i$1}=A(({videoData:{params:e,details:o,videoElementSizeInfo:E}})=>({params:e,details:o,videoElementSizeInfo:E}),shallowEqual),{currentTime:n$1,duration:Te}=A(({controller:{currentTime:e,duration:o,isEnded:E,firstPlay:w}})=>({currentTime:e,duration:o,isEnded:E,firstPlay:w}),shallowEqual),P=useRef(null),b$2=useRef(null),Re=useRef(0),L=useRef(0),V=useRef(0),C=useRef(0),I=useRef(0),Ve=useRef(1),Ce=useRef(P.current?.currentTime||0);ge(),we();let v=c$2.stream_link||s$1.stream_link;return useEffect(()=>{let e=P.current;if(!e||!v)return;qa(I),V.current=Date.now(),xa(e);let o$1=new u(c()),E=()=>o$1.loadSource(v),w=(t,p)=>e$1(o$1,p),Ie=()=>f(o$1,e),De=(t,p)=>g(o$1,p,r$1),ke=(t,p)=>h(o$1,p,r$1),Fe=(t,p)=>i(p),D$1=t=>j(t,L),k$1=t=>k(t,L),F=t=>l(t,b$2,e),xe=t=>r(t,b$2),x=t=>n(t),H=t=>o(t),U=()=>p(e),B=t=>q(t,e),M=t=>a$1(t),O=()=>D(e),_=()=>m(Ve,I,V,C,b$2,Re,L,Ce,e);return u.isSupported()?(o$1.on(u.Events.MEDIA_ATTACHED,E),o$1.on(u.Events.MANIFEST_PARSED,w),o$1.on(u.Events.FRAG_BUFFERED,Ie),o$1.on(u.Events.FRAG_CHANGED,De),o$1.on(u.Events.FRAG_PARSED,ke),o$1.on(u.Events.ERROR,Fe),o$1.attachMedia(e)):e.canPlayType("application/vnd.apple.mpegurl")&&(e.src=v,b(),e.addEventListener("play",xe),e.addEventListener("playing",s),e.addEventListener("timeupdate",t),e.addEventListener("ended",u$1)),e.addEventListener("waiting",D$1),e.addEventListener("seeking",k$1),e.addEventListener("play",F),e.addEventListener("playing",_),e.addEventListener("pause",x),e.addEventListener("timeupdate",H),e.addEventListener("canplay",U),e.addEventListener("ended",B),e.addEventListener("error",M),document.addEventListener("visibilitychange",O),()=>{o$1.destroy(),e.removeEventListener("waiting",D$1),e.removeEventListener("seeking",k$1),e.removeEventListener("play",F),e.removeEventListener("playing",_),e.removeEventListener("pause",x),e.removeEventListener("timeupdate",H),e.removeEventListener("canplay",U),e.removeEventListener("ended",B),e.removeEventListener("error",M),document.removeEventListener("visibilitychange",O);}},[v]),useEffect(()=>{n$1<Te&&t$1("isEnded")&&y(u$2(false));},[n$1]),Le(a$2),a(),c$1(),b$1(),d(),jsx(Fragment,{children:jsx("video",{ref:P,playsInline:true,id:"player-tag",preload:"metadata",crossOrigin:"anonymous",poster:s$1.banner?s$1.banner:c$2.banner,autoPlay:!!t$1("hasAutoPlay")||!!s$1.advertisement,className:`pl-items-center pl-flex-1 pl-h-full ${!t$1("isTouchScreen")&&!t$1("isFullScreen")&&"!pl-rounded-[12px]"}`,style:{width:"100%",height:"100%",maxWidth:i$1.width?i$1.width:"100%",maxHeight:i$1.width?i$1.width<i$1.height?i$1.width*9/16:i$1.width*16/9:"100%"},children:jsx($e,{fill:true,style:{objectFit:"cover"},src:s$1.banner?s$1.banner:c$2.banner,onLoad:()=>C.current=Date.now(),alt:s$1.bannerAlt?s$1.bannerAlt:t$1("isStaticFormat")?"\u0628\u0646\u0631 \u0648\u06CC\u062F\u06CC\u0648 \u067E\u0644\u06CC\u0631 \u06A9\u0627\u0641\u0647 \u0648\u06CC\u062F\u06CC\u0648":c$2.title??""})})})},Dn=Ge;export{Dn as default};//# sourceMappingURL=nonStaticVideoTag-J6JNATM6.mjs.map
2
- //# sourceMappingURL=nonStaticVideoTag-J6JNATM6.mjs.map
1
+ import {a,c as c$1,b as b$1,d}from'./chunk-6LGS5W4B.mjs';import {c,b,s,t,u as u$1,e as e$1,f,g,h,i,j,k,l,r,n,o,p,q,a as a$1,D,m}from'./chunk-QFADUEGX.mjs';import {c as c$2}from'./chunk-2DV7FRU5.mjs';import {a as a$2}from'./chunk-UL5LQB3G.mjs';import'./chunk-HOAJ3EFI.mjs';import {qa,xa,t as t$1,w,I,J}from'./chunk-NLCBOGTI.mjs';import {e,z,A,u as u$2}from'./chunk-4QMWBTB5.mjs';import u from'hls.js';import {useState,useRef,useEffect}from'react';import {shallowEqual}from'react-redux';import $e from'next/image';import {jsx,Fragment}from'react/jsx-runtime';e();e();var Be=()=>{let a=null,{isEnded:r}=A(({controller:{isEnded:y}})=>({isEnded:y}),shallowEqual);useEffect(()=>(a=setInterval(()=>a$2(),c$2),()=>clearInterval(a)),[]),useEffect(()=>{t$1("isEnded")&&clearInterval(a);},[r]);},ge=Be;e();var Oe=a=>{let[r,y]=useState([]),[s,c]=useState(0),{qualityLevels:i}=A(({controller:{qualityLevels:n}})=>({qualityLevels:n}),shallowEqual);useEffect(()=>{if(a){let n=[];switch(r.length){case 0:n=[a];break;case 1:n=[a,...r];break;case 2:n=[a,...r],w(I(`${n[0]}P`,`${n[1]}P`,i.indexOf(n[0])-i.indexOf(n[1])));break;default:n=[a,r[0],r[1]],n[1]!==n[2]&&w(I(`${n[1]}P`,`${n[2]}P`,i.indexOf(n[1])-i.indexOf(n[2])));break}y(n);}},[a]),useEffect(()=>{r.length===3&&r[0]===r[2]?(w(J(s,r)),y([]),c(0)):c(new Date().getTime());},[r]);},Le=Oe;e();var Ne=()=>{useEffect(()=>{let a=()=>{a$2();};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[]);},we=Ne;var Ge=()=>{let[a$2,r$1]=useState(void 0),y=z(),{params:s$1,details:c$2,videoElementSizeInfo:i$1}=A(({videoData:{params:e,details:o,videoElementSizeInfo:E}})=>({params:e,details:o,videoElementSizeInfo:E}),shallowEqual),{currentTime:n$1,duration:Te}=A(({controller:{currentTime:e,duration:o,isEnded:E,firstPlay:w}})=>({currentTime:e,duration:o,isEnded:E,firstPlay:w}),shallowEqual),P=useRef(null),b$2=useRef(null),Re=useRef(0),L=useRef(0),V=useRef(0),C=useRef(0),I=useRef(0),Ve=useRef(1),Ce=useRef(P.current?.currentTime||0);ge(),we();let v=c$2.stream_link||s$1.stream_link;return useEffect(()=>{let e=P.current;if(!e||!v)return;qa(I),V.current=Date.now(),xa(e);let o$1=new u(c()),E=()=>o$1.loadSource(v),w=(t,p)=>e$1(o$1,p),Ie=()=>f(o$1,e),De=(t,p)=>g(o$1,p,r$1),ke=(t,p)=>h(o$1,p,r$1),Fe=(t,p)=>i(p),D$1=t=>j(t,L),k$1=t=>k(t,L),F=t=>l(t,b$2,e),xe=t=>r(t,b$2),x=t=>n(t),H=t=>o(t),U=()=>p(e),B=t=>q(t,e),M=t=>a$1(t),O=()=>D(e),_=()=>m(Ve,I,V,C,b$2,Re,L,Ce,e);return u.isSupported()?(o$1.on(u.Events.MEDIA_ATTACHED,E),o$1.on(u.Events.MANIFEST_PARSED,w),o$1.on(u.Events.FRAG_BUFFERED,Ie),o$1.on(u.Events.FRAG_CHANGED,De),o$1.on(u.Events.FRAG_PARSED,ke),o$1.on(u.Events.ERROR,Fe),o$1.attachMedia(e)):e.canPlayType("application/vnd.apple.mpegurl")&&(e.src=v,b(),e.addEventListener("play",xe),e.addEventListener("playing",s),e.addEventListener("timeupdate",t),e.addEventListener("ended",u$1)),e.addEventListener("waiting",D$1),e.addEventListener("seeking",k$1),e.addEventListener("play",F),e.addEventListener("playing",_),e.addEventListener("pause",x),e.addEventListener("timeupdate",H),e.addEventListener("canplay",U),e.addEventListener("ended",B),e.addEventListener("error",M),document.addEventListener("visibilitychange",O),()=>{o$1.destroy(),e.removeEventListener("waiting",D$1),e.removeEventListener("seeking",k$1),e.removeEventListener("play",F),e.removeEventListener("playing",_),e.removeEventListener("pause",x),e.removeEventListener("timeupdate",H),e.removeEventListener("canplay",U),e.removeEventListener("ended",B),e.removeEventListener("error",M),document.removeEventListener("visibilitychange",O);}},[v]),useEffect(()=>{n$1<Te&&t$1("isEnded")&&y(u$2(false));},[n$1]),Le(a$2),a(),c$1(),b$1(),d(),jsx(Fragment,{children:jsx("video",{ref:P,playsInline:true,id:"player-tag",preload:"metadata",crossOrigin:"anonymous",poster:s$1.banner?s$1.banner:c$2.banner,autoPlay:!!t$1("hasAutoPlay")||!!s$1.advertisement,className:`pl-items-center pl-flex-1 pl-h-full ${!t$1("isTouchScreen")&&!t$1("isFullScreen")&&"!pl-rounded-[12px]"}`,style:{width:"100%",height:"100%",maxWidth:i$1.width?i$1.width:"100%",maxHeight:i$1.width?i$1.width<i$1.height?i$1.width*9/16:i$1.width*16/9:"100%"},children:jsx($e,{fill:true,style:{objectFit:"cover"},src:s$1.banner?s$1.banner:c$2.banner,onLoad:()=>C.current=Date.now(),alt:s$1.bannerAlt?s$1.bannerAlt:t$1("isStaticFormat")?"\u0628\u0646\u0631 \u0648\u06CC\u062F\u06CC\u0648 \u067E\u0644\u06CC\u0631 \u06A9\u0627\u0641\u0647 \u0648\u06CC\u062F\u06CC\u0648":c$2.title??""})})})},Dn=Ge;export{Dn as default};//# sourceMappingURL=nonStaticVideoTag-P47FI6UV.mjs.map
2
+ //# sourceMappingURL=nonStaticVideoTag-P47FI6UV.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/videoPlayerLibrary/components/custom-components/videoTag/nonStaticVideoTag.tsx","../src/videoPlayerLibrary/helpers/hooks/useContinuousPlaybackInterval.tsx","../src/videoPlayerLibrary/helpers/hooks/usePingPong.tsx","../src/videoPlayerLibrary/helpers/hooks/useBeforeUnload.tsx"],"names":["init_esm_shims","useContinuousPlaybackInterval","interval","isEnded","useAppSelector","shallowEqual","useEffect","handleContinuousPlayback","continuousePlaybackIntervalTime","conditions","useContinuousPlaybackInterval_default","usePingPong","qualityLevel","qualityHistory","setQualityHistory","useState","startTimer","setStartTimer","qualityLevels","newQualityArray","sendFluentLog","autoQualityChangeLog","pingpongLog","usePingPong_default","useBeforeUnload","handleBeforeUnload","useBeforeUnload_default","NonStaticVideoTag","setQualityLevel","dispatch","useAppDispatch","params","details","videoElementSizeInfo","currentTime","duration","firstPlay","videoRef","useRef","timerRef","waitingDurationRef","waitingTimerRef","initialWaitingDurationRef","bannerLoadingDurationRef","loadingDurationRef","loadingCounterRef","videoEntranceTimeRef","streamUrl","video","handlePageLoadTime","setupAutoplayBehavior","hls","Hls","handleHlsConfig","onMediaAttached","onManifestParsed","e","data","handleManifestParsed","onFragBuffered","handleFragBuffered","onFragChanged","handleFragChanged","onFragParsed","handleFragParsed","onError","handleHlsErrors","onWaiting","handleVideoWaiting","onSeeking","handleVideoSeeking","onPlay","handleVideoPlay","onIosPlay","handleIosVideoPlay","onPause","handleVideoPause","onTimeUpdate","handleVideoTimeUpdate","onCanPlay","handleVideoCanPlay","onEnded","handleVideoEnded","onVideoError","handleVideoError","onVisibilitychange","handleVideoVisibilityChange","onPlaying","handleVideoPlaying","appendQueryParamsToChunksIOS","handleIosVideoPlaying","handleIosVideoTimeUpdate","handleIosVideoEnded","setIsEnded","useJumpToCurrentTime_default","useAppendSubtitle_default","useHideSubtitle_default","useActiveSubtitleAutomatic_default","jsx","Fragment","Image","nonStaticVideoTag_default"],"mappings":"6iBAAAA,CAAAA,EAAAA,CCAAA,CAAAA,EAAAA,CAQA,IAAMC,EAAAA,CAAgC,IAAM,CACxC,IAAIC,CAAAA,CAAgB,IAAA,CAEd,CAAE,OAAA,CAAAC,CAAQ,EAAIC,CAAAA,CAAe,CAAC,CAAE,UAAA,CAAY,CAAE,OAAA,CAAAD,CAAQ,CAAE,CAA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CAACvB,GAAAA,CAAAA,aAAoC,CAAA,EAAK,CAAC,CAACsB,GAAAA,CAAO,aAAA,CAC9D,SAAA,CAAW,CAAA,oCAAA,EACT,CAACtB,GAAAA,CAAAA,eAAsC,CAAA,EAAK,CAACA,GAAAA,CAAAA,cAAqC,GAAK,oBACzF,CAAA,CAAA,CACA,KAAA,CAAO,CACL,KAAA,CAAO,MAAA,CACP,MAAA,CAAQ,MAAA,CACR,QAAA,CAAUwB,GAAAA,CAAqB,KAAA,CAAQA,GAAAA,CAAqB,KAAA,CAAQ,MAAA,CACpE,UAAWA,GAAAA,CAAqB,KAAA,CAC5BA,GAAAA,CAAqB,KAAA,CAAQA,GAAAA,CAAqB,MAAA,CAC/CA,IAAqB,KAAA,CAAQ,CAAA,CAAK,EAAA,CAClCA,GAAAA,CAAqB,KAAA,CAAQ,EAAA,CAAM,EACtC,MACN,CAAA,CAEA,QAAA,CAAAiE,GAAAA,CAACE,EAAAA,CAAA,CACC,IAAA,CAAI,IAAA,CACJ,KAAA,CAAO,CAAE,SAAA,CAAW,OAAQ,CAAA,CAC5B,GAAA,CAAKrE,IAAO,MAAA,CAASA,GAAAA,CAAO,MAAA,CAASC,GAAAA,CAAQ,MAAA,CAC7C,MAAA,CAAQ,IAAOW,CAAAA,CAAyB,OAAA,CAAU,IAAA,CAAK,GAAA,EAAI,CAC3D,GAAA,CAAKZ,GAAAA,CAAO,UAAYA,GAAAA,CAAO,SAAA,CAAYtB,GAAAA,CAAAA,gBAAuC,CAAA,CAAI,oIAAA,CAA+BuB,GAAAA,CAAQ,KAAA,EAAS,EAAA,CACxI,CAAA,CACF,CAAA,CACF,CAEJ,CAAA,CAEOqE,EAAAA,CAAQ1E","file":"nonStaticVideoTag-J6JNATM6.mjs","sourcesContent":["\"use client\";\r\n\r\nimport Hls, { ErrorData } from \"hls.js\";\r\nimport { useEffect, useState, useRef } from \"react\";\r\nimport { shallowEqual } from \"react-redux\";\r\nimport { useAppDispatch, useAppSelector } from \"../../../helpers/redux/hooks\";\r\nimport useContinuousPlaybackInterval from \"../../../helpers/hooks/useContinuousPlaybackInterval\";\r\nimport { handlePageLoadTime, setupAutoplayBehavior } from \"../../../helpers/helpers\";\r\nimport {\r\n appendQueryParamsToChunksIOS,\r\n handleFragBuffered,\r\n handleFragChanged,\r\n handleFragParsed,\r\n handleHlsConfig,\r\n handleHlsErrors,\r\n handleIosVideoEnded,\r\n handleIosVideoPlay,\r\n handleIosVideoPlaying,\r\n handleIosVideoTimeUpdate,\r\n handleManifestParsed,\r\n handleVideoCanPlay,\r\n handleVideoEnded,\r\n handleVideoError,\r\n handleVideoPause,\r\n handleVideoPlay,\r\n handleVideoPlaying,\r\n handleVideoSeeking,\r\n handleVideoTimeUpdate,\r\n handleVideoVisibilityChange,\r\n handleVideoWaiting,\r\n} from \"../../../helpers/redux/actions/playerCore.actions\";\r\nimport { ConditionName } from \"../../../helpers/interfaces/enums\";\r\nimport { conditions } from \"../../../helpers/conditions/conditions\";\r\nimport { setIsEnded } from \"../../../helpers/redux/slices/controllerSlice\";\r\nimport usePingPong from \"../../../helpers/hooks/usePingPong\";\r\nimport useBeforeUnload from \"../../../helpers/hooks/useBeforeUnload\";\r\nimport useHideSubtitle from \"../../../helpers/hooks/useHideSubtitle\";\r\nimport useJumpToCurrentTime from \"../../../helpers/hooks/useJumpToCurrentTime\";\r\nimport useAppendSubtitle from \"../../../helpers/hooks/useAppendSubtitle\";\r\nimport useActiveSubtitleAutomatic from \"../../../helpers/hooks/useActiveSubtitleAutomatic\";\r\nimport Image from \"next/image\";\r\n\r\nconst NonStaticVideoTag = () => {\r\n const [qualityLevel, setQualityLevel] = useState<number | undefined>(undefined);\r\n\r\n const dispatch = useAppDispatch();\r\n const { params, details, videoElementSizeInfo } = useAppSelector(\r\n ({ videoData: { params, details, videoElementSizeInfo } }) => ({\r\n params,\r\n details,\r\n videoElementSizeInfo,\r\n }),\r\n shallowEqual,\r\n );\r\n const { currentTime, duration } = useAppSelector(\r\n ({ controller: { currentTime, duration, isEnded, firstPlay } }) => ({\r\n currentTime,\r\n duration,\r\n isEnded,\r\n firstPlay,\r\n }),\r\n shallowEqual,\r\n );\r\n\r\n const videoRef = useRef<HTMLVideoElement | null>(null);\r\n const timerRef = useRef<any>(null);\r\n const waitingDurationRef = useRef<any>(0);\r\n const waitingTimerRef = useRef<number>(0);\r\n const initialWaitingDurationRef = useRef<any>(0);\r\n const bannerLoadingDurationRef = useRef<any>(0);\r\n const loadingDurationRef = useRef<any>(0);\r\n const loadingCounterRef = useRef<any>(1);\r\n const videoEntranceTimeRef = useRef<any>(videoRef.current?.currentTime || 0);\r\n\r\n useContinuousPlaybackInterval();\r\n useBeforeUnload();\r\n\r\n const streamUrl = details.stream_link || params.stream_link;\r\n\r\n useEffect(() => {\r\n const video = videoRef.current;\r\n\r\n if (!video || !streamUrl) return;\r\n\r\n // ---- Page Load Time ----\r\n handlePageLoadTime(loadingDurationRef);\r\n initialWaitingDurationRef.current = Date.now();\r\n setupAutoplayBehavior(video);\r\n\r\n const hls = new Hls(handleHlsConfig());\r\n // ---------------- HLS EVENTS ----------------\r\n const onMediaAttached = () => hls.loadSource(streamUrl);\r\n const onManifestParsed = (e: any, data: any) => handleManifestParsed(hls, data);\r\n const onFragBuffered = () => handleFragBuffered(hls, video);\r\n const onFragChanged = (e: any, data: any) => handleFragChanged(hls, data, setQualityLevel);\r\n const onFragParsed = (e: any, data: any) => handleFragParsed(hls, data, setQualityLevel);\r\n const onError = (e: any, data: ErrorData) => handleHlsErrors(data);\r\n\r\n // ---------------- VIDEO EVENTS ----------------\r\n const onWaiting = (e: any) => handleVideoWaiting(e, waitingTimerRef);\r\n const onSeeking = (e: any) => handleVideoSeeking(e, waitingTimerRef);\r\n const onPlay = (e: any) => handleVideoPlay(e, timerRef, video);\r\n const onIosPlay = (e: any) => handleIosVideoPlay(e, timerRef);\r\n const onPause = (e: any) => handleVideoPause(e);\r\n const onTimeUpdate = (e: any) => handleVideoTimeUpdate(e);\r\n const onCanPlay = () => handleVideoCanPlay(video);\r\n const onEnded = (e: any) => handleVideoEnded(e, video);\r\n const onVideoError = (e: any) => handleVideoError(e);\r\n const onVisibilitychange = () => handleVideoVisibilityChange(video);\r\n const onPlaying = () =>\r\n handleVideoPlaying(\r\n loadingCounterRef,\r\n loadingDurationRef,\r\n initialWaitingDurationRef,\r\n bannerLoadingDurationRef,\r\n timerRef,\r\n waitingDurationRef,\r\n waitingTimerRef,\r\n videoEntranceTimeRef,\r\n video,\r\n );\r\n\r\n // ---------------- INIT ----------------\r\n if (Hls.isSupported()) {\r\n hls.on(Hls.Events.MEDIA_ATTACHED, onMediaAttached);\r\n hls.on(Hls.Events.MANIFEST_PARSED, onManifestParsed);\r\n hls.on(Hls.Events.FRAG_BUFFERED, onFragBuffered);\r\n hls.on(Hls.Events.FRAG_CHANGED, onFragChanged);\r\n hls.on(Hls.Events.FRAG_PARSED, onFragParsed);\r\n hls.on(Hls.Events.ERROR, onError);\r\n\r\n hls.attachMedia(video);\r\n } else if (video.canPlayType(\"application/vnd.apple.mpegurl\")) {\r\n video.src = streamUrl;\r\n appendQueryParamsToChunksIOS();\r\n\r\n video.addEventListener(\"play\", onIosPlay);\r\n video.addEventListener(\"playing\", handleIosVideoPlaying);\r\n video.addEventListener(\"timeupdate\", handleIosVideoTimeUpdate);\r\n video.addEventListener(\"ended\", handleIosVideoEnded);\r\n }\r\n\r\n video.addEventListener(\"waiting\", onWaiting);\r\n video.addEventListener(\"seeking\", onSeeking);\r\n video.addEventListener(\"play\", onPlay);\r\n video.addEventListener(\"playing\", onPlaying);\r\n video.addEventListener(\"pause\", onPause);\r\n video.addEventListener(\"timeupdate\", onTimeUpdate);\r\n video.addEventListener(\"canplay\", onCanPlay);\r\n video.addEventListener(\"ended\", onEnded);\r\n video.addEventListener(\"error\", onVideoError);\r\n\r\n document.addEventListener(\"visibilitychange\", onVisibilitychange);\r\n\r\n // ---------------- CLEANUP ----------------\r\n return () => {\r\n hls.destroy();\r\n\r\n video.removeEventListener(\"waiting\", onWaiting);\r\n video.removeEventListener(\"seeking\", onSeeking);\r\n video.removeEventListener(\"play\", onPlay);\r\n video.removeEventListener(\"playing\", onPlaying);\r\n video.removeEventListener(\"pause\", onPause);\r\n video.removeEventListener(\"timeupdate\", onTimeUpdate);\r\n video.removeEventListener(\"canplay\", onCanPlay);\r\n video.removeEventListener(\"ended\", onEnded);\r\n video.removeEventListener(\"error\", onVideoError);\r\n\r\n document.removeEventListener(\"visibilitychange\", onVisibilitychange);\r\n };\r\n }, [streamUrl]);\r\n\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n useEffect(() => {\r\n if (currentTime < duration && conditions(ConditionName.isEnded)) dispatch(setIsEnded(false));\r\n }, [currentTime]);\r\n\r\n usePingPong(qualityLevel);\r\n\r\n useJumpToCurrentTime();\r\n useAppendSubtitle();\r\n useHideSubtitle();\r\n useActiveSubtitleAutomatic();\r\n\r\n return (\r\n <>\r\n <video\r\n ref={videoRef}\r\n playsInline\r\n id=\"player-tag\"\r\n preload=\"metadata\"\r\n crossOrigin=\"anonymous\"\r\n poster={params.banner ? params.banner : details.banner}\r\n autoPlay={!!conditions(ConditionName.hasAutoPlay) || !!params.advertisement}\r\n className={`pl-items-center pl-flex-1 pl-h-full ${\r\n !conditions(ConditionName.isTouchScreen) && !conditions(ConditionName.isFullScreen) && \"!pl-rounded-[12px]\"\r\n }`}\r\n style={{\r\n width: \"100%\",\r\n height: \"100%\",\r\n maxWidth: videoElementSizeInfo.width ? videoElementSizeInfo.width : \"100%\",\r\n maxHeight: videoElementSizeInfo.width\r\n ? videoElementSizeInfo.width < videoElementSizeInfo.height\r\n ? (videoElementSizeInfo.width * 9) / 16\r\n : (videoElementSizeInfo.width * 16) / 9\r\n : \"100%\",\r\n }}\r\n >\r\n <Image\r\n fill\r\n style={{ objectFit: \"cover\" }}\r\n src={params.banner ? params.banner : details.banner}\r\n onLoad={() => (bannerLoadingDurationRef.current = Date.now())}\r\n alt={params.bannerAlt ? params.bannerAlt : conditions(ConditionName.isStaticFormat) ? \"بنر ویدیو پلیر کافه ویدیو\" : (details.title ?? \"\")}\r\n />\r\n </video>\r\n </>\r\n );\r\n};\r\n\r\nexport default NonStaticVideoTag;\r\n","import { useEffect } from \"react\";\nimport { shallowEqual } from \"react-redux\";\nimport { useAppSelector } from \"../redux/hooks\";\nimport { continuousePlaybackIntervalTime } from \"../environment\";\nimport { ConditionName } from \"../interfaces/enums\";\nimport { conditions } from \"../conditions/conditions\";\nimport { handleContinuousPlayback } from \"../redux/actions/user.actions\";\n\nconst useContinuousPlaybackInterval = () => {\n let interval: any = null;\n\n const { isEnded } = useAppSelector(({ controller: { isEnded } }) => ({ isEnded }), shallowEqual);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n interval = setInterval(() => handleContinuousPlayback(), continuousePlaybackIntervalTime);\n return () => clearInterval(interval);\n }, []);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (conditions(ConditionName.isEnded)) clearInterval(interval);\n }, [isEnded]);\n};\n\nexport default useContinuousPlaybackInterval;\n","import { useEffect, useState } from \"react\";\nimport { shallowEqual } from \"react-redux\";\nimport { useAppSelector } from \"../redux/hooks\";\nimport { sendFluentLog } from \"../logs/fluentdLogger\";\nimport { autoQualityChangeLog, pingpongLog } from \"../logs/logs\";\n\nconst usePingPong = (qualityLevel?: number) => {\n const [qualityHistory, setQualityHistory] = useState<number[]>([]);\n const [startTimer, setStartTimer] = useState<number>(0);\n\n const { qualityLevels } = useAppSelector(({ controller: { qualityLevels } }) => ({ qualityLevels }), shallowEqual);\n\n useEffect(() => {\n if (qualityLevel) {\n let newQualityArray: number[] = [];\n switch (qualityHistory.length) {\n case 0:\n newQualityArray = [qualityLevel];\n break;\n case 1:\n newQualityArray = [qualityLevel, ...qualityHistory];\n break;\n case 2:\n newQualityArray = [qualityLevel, ...qualityHistory];\n sendFluentLog(\n autoQualityChangeLog(\n `${newQualityArray[0]}P`,\n `${newQualityArray[1]}P`,\n qualityLevels.indexOf(newQualityArray[0]) - qualityLevels.indexOf(newQualityArray[1])\n )\n );\n break;\n default:\n newQualityArray = [qualityLevel, qualityHistory[0], qualityHistory[1]];\n if (newQualityArray[1] !== newQualityArray[2])\n sendFluentLog(\n autoQualityChangeLog(\n `${newQualityArray[1]}P`,\n `${newQualityArray[2]}P`,\n qualityLevels.indexOf(newQualityArray[1]) - qualityLevels.indexOf(newQualityArray[2])\n )\n );\n break;\n }\n setQualityHistory(newQualityArray);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [qualityLevel]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (qualityHistory.length === 3 && qualityHistory[0] === qualityHistory[2]) {\n sendFluentLog(pingpongLog(startTimer, qualityHistory));\n setQualityHistory([]);\n setStartTimer(0);\n } else {\n setStartTimer(new Date().getTime());\n }\n }, [qualityHistory]);\n};\nexport default usePingPong;\n","import { useEffect } from \"react\";\nimport { handleContinuousPlayback } from \"../redux/actions/user.actions\";\n\nconst useBeforeUnload = () => {\n useEffect(() => {\n const handleBeforeUnload = () => {\n handleContinuousPlayback();\n };\n\n window.addEventListener(\"beforeunload\", handleBeforeUnload);\n return () => window.removeEventListener(\"beforeunload\", handleBeforeUnload);\n }, []);\n};\n\nexport default useBeforeUnload;\n"]}
1
+ {"version":3,"sources":["../src/videoPlayerLibrary/components/custom-components/videoTag/nonStaticVideoTag.tsx","../src/videoPlayerLibrary/helpers/hooks/useContinuousPlaybackInterval.tsx","../src/videoPlayerLibrary/helpers/hooks/usePingPong.tsx","../src/videoPlayerLibrary/helpers/hooks/useBeforeUnload.tsx"],"names":["init_esm_shims","useContinuousPlaybackInterval","interval","isEnded","useAppSelector","shallowEqual","useEffect","handleContinuousPlayback","continuousePlaybackIntervalTime","conditions","useContinuousPlaybackInterval_default","usePingPong","qualityLevel","qualityHistory","setQualityHistory","useState","startTimer","setStartTimer","qualityLevels","newQualityArray","sendFluentLog","autoQualityChangeLog","pingpongLog","usePingPong_default","useBeforeUnload","handleBeforeUnload","useBeforeUnload_default","NonStaticVideoTag","setQualityLevel","dispatch","useAppDispatch","params","details","videoElementSizeInfo","currentTime","duration","firstPlay","videoRef","useRef","timerRef","waitingDurationRef","waitingTimerRef","initialWaitingDurationRef","bannerLoadingDurationRef","loadingDurationRef","loadingCounterRef","videoEntranceTimeRef","streamUrl","video","handlePageLoadTime","setupAutoplayBehavior","hls","Hls","handleHlsConfig","onMediaAttached","onManifestParsed","e","data","handleManifestParsed","onFragBuffered","handleFragBuffered","onFragChanged","handleFragChanged","onFragParsed","handleFragParsed","onError","handleHlsErrors","onWaiting","handleVideoWaiting","onSeeking","handleVideoSeeking","onPlay","handleVideoPlay","onIosPlay","handleIosVideoPlay","onPause","handleVideoPause","onTimeUpdate","handleVideoTimeUpdate","onCanPlay","handleVideoCanPlay","onEnded","handleVideoEnded","onVideoError","handleVideoError","onVisibilitychange","handleVideoVisibilityChange","onPlaying","handleVideoPlaying","appendQueryParamsToChunksIOS","handleIosVideoPlaying","handleIosVideoTimeUpdate","handleIosVideoEnded","setIsEnded","useJumpToCurrentTime_default","useAppendSubtitle_default","useHideSubtitle_default","useActiveSubtitleAutomatic_default","jsx","Fragment","Image","nonStaticVideoTag_default"],"mappings":"6iBAAAA,CAAAA,EAAAA,CCAAA,CAAAA,EAAAA,CAQA,IAAMC,EAAAA,CAAgC,IAAM,CACxC,IAAIC,CAAAA,CAAgB,IAAA,CAEd,CAAE,OAAA,CAAAC,CAAQ,EAAIC,CAAAA,CAAe,CAAC,CAAE,UAAA,CAAY,CAAE,OAAA,CAAAD,CAAQ,CAAE,CAAA,IAAO,CAAE,OAAA,CAAAA,CAAQ,CAAA,CAAA,CAAIE,YAAY,CAAA,CAG/FC,SAAAA,CAAU,KACNJ,CAAAA,CAAW,WAAA,CAAY,IAAMK,GAAAA,GAA4BC,GAA+B,CAAA,CACjF,IAAM,aAAA,CAAcN,CAAQ,CAAA,CAAA,CACpC,EAAE,CAAA,C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,CACL,KAAA,CAAO,MAAA,CACP,MAAA,CAAQ,MAAA,CACR,QAAA,CAAUwB,GAAAA,CAAqB,KAAA,CAAQA,GAAAA,CAAqB,KAAA,CAAQ,MAAA,CACpE,UAAWA,GAAAA,CAAqB,KAAA,CAC5BA,GAAAA,CAAqB,KAAA,CAAQA,GAAAA,CAAqB,MAAA,CAC/CA,IAAqB,KAAA,CAAQ,CAAA,CAAK,EAAA,CAClCA,GAAAA,CAAqB,KAAA,CAAQ,EAAA,CAAM,EACtC,MACN,CAAA,CAEA,QAAA,CAAAiE,GAAAA,CAACE,EAAAA,CAAA,CACC,IAAA,CAAI,IAAA,CACJ,KAAA,CAAO,CAAE,SAAA,CAAW,OAAQ,CAAA,CAC5B,GAAA,CAAKrE,IAAO,MAAA,CAASA,GAAAA,CAAO,MAAA,CAASC,GAAAA,CAAQ,MAAA,CAC7C,MAAA,CAAQ,IAAOW,CAAAA,CAAyB,OAAA,CAAU,IAAA,CAAK,GAAA,EAAI,CAC3D,GAAA,CAAKZ,GAAAA,CAAO,UAAYA,GAAAA,CAAO,SAAA,CAAYtB,GAAAA,CAAAA,gBAAuC,CAAA,CAAI,oIAAA,CAA+BuB,GAAAA,CAAQ,KAAA,EAAS,EAAA,CACxI,CAAA,CACF,CAAA,CACF,CAEJ,CAAA,CAEOqE,EAAAA,CAAQ1E","file":"nonStaticVideoTag-P47FI6UV.mjs","sourcesContent":["\"use client\";\r\n\r\nimport Hls, { ErrorData } from \"hls.js\";\r\nimport { useEffect, useState, useRef } from \"react\";\r\nimport { shallowEqual } from \"react-redux\";\r\nimport { useAppDispatch, useAppSelector } from \"../../../helpers/redux/hooks\";\r\nimport useContinuousPlaybackInterval from \"../../../helpers/hooks/useContinuousPlaybackInterval\";\r\nimport { handlePageLoadTime, setupAutoplayBehavior } from \"../../../helpers/helpers\";\r\nimport {\r\n appendQueryParamsToChunksIOS,\r\n handleFragBuffered,\r\n handleFragChanged,\r\n handleFragParsed,\r\n handleHlsConfig,\r\n handleHlsErrors,\r\n handleIosVideoEnded,\r\n handleIosVideoPlay,\r\n handleIosVideoPlaying,\r\n handleIosVideoTimeUpdate,\r\n handleManifestParsed,\r\n handleVideoCanPlay,\r\n handleVideoEnded,\r\n handleVideoError,\r\n handleVideoPause,\r\n handleVideoPlay,\r\n handleVideoPlaying,\r\n handleVideoSeeking,\r\n handleVideoTimeUpdate,\r\n handleVideoVisibilityChange,\r\n handleVideoWaiting,\r\n} from \"../../../helpers/redux/actions/playerCore.actions\";\r\nimport { ConditionName } from \"../../../helpers/interfaces/enums\";\r\nimport { conditions } from \"../../../helpers/conditions/conditions\";\r\nimport { setIsEnded } from \"../../../helpers/redux/slices/controllerSlice\";\r\nimport usePingPong from \"../../../helpers/hooks/usePingPong\";\r\nimport useBeforeUnload from \"../../../helpers/hooks/useBeforeUnload\";\r\nimport useHideSubtitle from \"../../../helpers/hooks/useHideSubtitle\";\r\nimport useJumpToCurrentTime from \"../../../helpers/hooks/useJumpToCurrentTime\";\r\nimport useAppendSubtitle from \"../../../helpers/hooks/useAppendSubtitle\";\r\nimport useActiveSubtitleAutomatic from \"../../../helpers/hooks/useActiveSubtitleAutomatic\";\r\nimport Image from \"next/image\";\r\n\r\nconst NonStaticVideoTag = () => {\r\n const [qualityLevel, setQualityLevel] = useState<number | undefined>(undefined);\r\n\r\n const dispatch = useAppDispatch();\r\n const { params, details, videoElementSizeInfo } = useAppSelector(\r\n ({ videoData: { params, details, videoElementSizeInfo } }) => ({\r\n params,\r\n details,\r\n videoElementSizeInfo,\r\n }),\r\n shallowEqual,\r\n );\r\n const { currentTime, duration } = useAppSelector(\r\n ({ controller: { currentTime, duration, isEnded, firstPlay } }) => ({\r\n currentTime,\r\n duration,\r\n isEnded,\r\n firstPlay,\r\n }),\r\n shallowEqual,\r\n );\r\n\r\n const videoRef = useRef<HTMLVideoElement | null>(null);\r\n const timerRef = useRef<any>(null);\r\n const waitingDurationRef = useRef<any>(0);\r\n const waitingTimerRef = useRef<number>(0);\r\n const initialWaitingDurationRef = useRef<any>(0);\r\n const bannerLoadingDurationRef = useRef<any>(0);\r\n const loadingDurationRef = useRef<any>(0);\r\n const loadingCounterRef = useRef<any>(1);\r\n const videoEntranceTimeRef = useRef<any>(videoRef.current?.currentTime || 0);\r\n\r\n useContinuousPlaybackInterval();\r\n useBeforeUnload();\r\n\r\n const streamUrl = details.stream_link || params.stream_link;\r\n\r\n useEffect(() => {\r\n const video = videoRef.current;\r\n\r\n if (!video || !streamUrl) return;\r\n\r\n // ---- Page Load Time ----\r\n handlePageLoadTime(loadingDurationRef);\r\n initialWaitingDurationRef.current = Date.now();\r\n setupAutoplayBehavior(video);\r\n\r\n const hls = new Hls(handleHlsConfig());\r\n // ---------------- HLS EVENTS ----------------\r\n const onMediaAttached = () => hls.loadSource(streamUrl);\r\n const onManifestParsed = (e: any, data: any) => handleManifestParsed(hls, data);\r\n const onFragBuffered = () => handleFragBuffered(hls, video);\r\n const onFragChanged = (e: any, data: any) => handleFragChanged(hls, data, setQualityLevel);\r\n const onFragParsed = (e: any, data: any) => handleFragParsed(hls, data, setQualityLevel);\r\n const onError = (e: any, data: ErrorData) => handleHlsErrors(data);\r\n\r\n // ---------------- VIDEO EVENTS ----------------\r\n const onWaiting = (e: any) => handleVideoWaiting(e, waitingTimerRef);\r\n const onSeeking = (e: any) => handleVideoSeeking(e, waitingTimerRef);\r\n const onPlay = (e: any) => handleVideoPlay(e, timerRef, video);\r\n const onIosPlay = (e: any) => handleIosVideoPlay(e, timerRef);\r\n const onPause = (e: any) => handleVideoPause(e);\r\n const onTimeUpdate = (e: any) => handleVideoTimeUpdate(e);\r\n const onCanPlay = () => handleVideoCanPlay(video);\r\n const onEnded = (e: any) => handleVideoEnded(e, video);\r\n const onVideoError = (e: any) => handleVideoError(e);\r\n const onVisibilitychange = () => handleVideoVisibilityChange(video);\r\n const onPlaying = () =>\r\n handleVideoPlaying(\r\n loadingCounterRef,\r\n loadingDurationRef,\r\n initialWaitingDurationRef,\r\n bannerLoadingDurationRef,\r\n timerRef,\r\n waitingDurationRef,\r\n waitingTimerRef,\r\n videoEntranceTimeRef,\r\n video,\r\n );\r\n\r\n // ---------------- INIT ----------------\r\n if (Hls.isSupported()) {\r\n hls.on(Hls.Events.MEDIA_ATTACHED, onMediaAttached);\r\n hls.on(Hls.Events.MANIFEST_PARSED, onManifestParsed);\r\n hls.on(Hls.Events.FRAG_BUFFERED, onFragBuffered);\r\n hls.on(Hls.Events.FRAG_CHANGED, onFragChanged);\r\n hls.on(Hls.Events.FRAG_PARSED, onFragParsed);\r\n hls.on(Hls.Events.ERROR, onError);\r\n\r\n hls.attachMedia(video);\r\n } else if (video.canPlayType(\"application/vnd.apple.mpegurl\")) {\r\n video.src = streamUrl;\r\n appendQueryParamsToChunksIOS();\r\n\r\n video.addEventListener(\"play\", onIosPlay);\r\n video.addEventListener(\"playing\", handleIosVideoPlaying);\r\n video.addEventListener(\"timeupdate\", handleIosVideoTimeUpdate);\r\n video.addEventListener(\"ended\", handleIosVideoEnded);\r\n }\r\n\r\n video.addEventListener(\"waiting\", onWaiting);\r\n video.addEventListener(\"seeking\", onSeeking);\r\n video.addEventListener(\"play\", onPlay);\r\n video.addEventListener(\"playing\", onPlaying);\r\n video.addEventListener(\"pause\", onPause);\r\n video.addEventListener(\"timeupdate\", onTimeUpdate);\r\n video.addEventListener(\"canplay\", onCanPlay);\r\n video.addEventListener(\"ended\", onEnded);\r\n video.addEventListener(\"error\", onVideoError);\r\n\r\n document.addEventListener(\"visibilitychange\", onVisibilitychange);\r\n\r\n // ---------------- CLEANUP ----------------\r\n return () => {\r\n hls.destroy();\r\n\r\n video.removeEventListener(\"waiting\", onWaiting);\r\n video.removeEventListener(\"seeking\", onSeeking);\r\n video.removeEventListener(\"play\", onPlay);\r\n video.removeEventListener(\"playing\", onPlaying);\r\n video.removeEventListener(\"pause\", onPause);\r\n video.removeEventListener(\"timeupdate\", onTimeUpdate);\r\n video.removeEventListener(\"canplay\", onCanPlay);\r\n video.removeEventListener(\"ended\", onEnded);\r\n video.removeEventListener(\"error\", onVideoError);\r\n\r\n document.removeEventListener(\"visibilitychange\", onVisibilitychange);\r\n };\r\n }, [streamUrl]);\r\n\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n useEffect(() => {\r\n if (currentTime < duration && conditions(ConditionName.isEnded)) dispatch(setIsEnded(false));\r\n }, [currentTime]);\r\n\r\n usePingPong(qualityLevel);\r\n\r\n useJumpToCurrentTime();\r\n useAppendSubtitle();\r\n useHideSubtitle();\r\n useActiveSubtitleAutomatic();\r\n\r\n return (\r\n <>\r\n <video\r\n ref={videoRef}\r\n playsInline\r\n id=\"player-tag\"\r\n preload=\"metadata\"\r\n crossOrigin=\"anonymous\"\r\n poster={params.banner ? params.banner : details.banner}\r\n autoPlay={!!conditions(ConditionName.hasAutoPlay) || !!params.advertisement}\r\n className={`pl-items-center pl-flex-1 pl-h-full ${\r\n !conditions(ConditionName.isTouchScreen) && !conditions(ConditionName.isFullScreen) && \"!pl-rounded-[12px]\"\r\n }`}\r\n style={{\r\n width: \"100%\",\r\n height: \"100%\",\r\n maxWidth: videoElementSizeInfo.width ? videoElementSizeInfo.width : \"100%\",\r\n maxHeight: videoElementSizeInfo.width\r\n ? videoElementSizeInfo.width < videoElementSizeInfo.height\r\n ? (videoElementSizeInfo.width * 9) / 16\r\n : (videoElementSizeInfo.width * 16) / 9\r\n : \"100%\",\r\n }}\r\n >\r\n <Image\r\n fill\r\n style={{ objectFit: \"cover\" }}\r\n src={params.banner ? params.banner : details.banner}\r\n onLoad={() => (bannerLoadingDurationRef.current = Date.now())}\r\n alt={params.bannerAlt ? params.bannerAlt : conditions(ConditionName.isStaticFormat) ? \"بنر ویدیو پلیر کافه ویدیو\" : (details.title ?? \"\")}\r\n />\r\n </video>\r\n </>\r\n );\r\n};\r\n\r\nexport default NonStaticVideoTag;\r\n","import { useEffect } from \"react\";\nimport { shallowEqual } from \"react-redux\";\nimport { useAppSelector } from \"../redux/hooks\";\nimport { continuousePlaybackIntervalTime } from \"../environment\";\nimport { ConditionName } from \"../interfaces/enums\";\nimport { conditions } from \"../conditions/conditions\";\nimport { handleContinuousPlayback } from \"../redux/actions/user.actions\";\n\nconst useContinuousPlaybackInterval = () => {\n let interval: any = null;\n\n const { isEnded } = useAppSelector(({ controller: { isEnded } }) => ({ isEnded }), shallowEqual);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n interval = setInterval(() => handleContinuousPlayback(), continuousePlaybackIntervalTime);\n return () => clearInterval(interval);\n }, []);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (conditions(ConditionName.isEnded)) clearInterval(interval);\n }, [isEnded]);\n};\n\nexport default useContinuousPlaybackInterval;\n","import { useEffect, useState } from \"react\";\nimport { shallowEqual } from \"react-redux\";\nimport { useAppSelector } from \"../redux/hooks\";\nimport { sendFluentLog } from \"../logs/fluentdLogger\";\nimport { autoQualityChangeLog, pingpongLog } from \"../logs/logs\";\n\nconst usePingPong = (qualityLevel?: number) => {\n const [qualityHistory, setQualityHistory] = useState<number[]>([]);\n const [startTimer, setStartTimer] = useState<number>(0);\n\n const { qualityLevels } = useAppSelector(({ controller: { qualityLevels } }) => ({ qualityLevels }), shallowEqual);\n\n useEffect(() => {\n if (qualityLevel) {\n let newQualityArray: number[] = [];\n switch (qualityHistory.length) {\n case 0:\n newQualityArray = [qualityLevel];\n break;\n case 1:\n newQualityArray = [qualityLevel, ...qualityHistory];\n break;\n case 2:\n newQualityArray = [qualityLevel, ...qualityHistory];\n sendFluentLog(\n autoQualityChangeLog(\n `${newQualityArray[0]}P`,\n `${newQualityArray[1]}P`,\n qualityLevels.indexOf(newQualityArray[0]) - qualityLevels.indexOf(newQualityArray[1])\n )\n );\n break;\n default:\n newQualityArray = [qualityLevel, qualityHistory[0], qualityHistory[1]];\n if (newQualityArray[1] !== newQualityArray[2])\n sendFluentLog(\n autoQualityChangeLog(\n `${newQualityArray[1]}P`,\n `${newQualityArray[2]}P`,\n qualityLevels.indexOf(newQualityArray[1]) - qualityLevels.indexOf(newQualityArray[2])\n )\n );\n break;\n }\n setQualityHistory(newQualityArray);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [qualityLevel]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (qualityHistory.length === 3 && qualityHistory[0] === qualityHistory[2]) {\n sendFluentLog(pingpongLog(startTimer, qualityHistory));\n setQualityHistory([]);\n setStartTimer(0);\n } else {\n setStartTimer(new Date().getTime());\n }\n }, [qualityHistory]);\n};\nexport default usePingPong;\n","import { useEffect } from \"react\";\nimport { handleContinuousPlayback } from \"../redux/actions/user.actions\";\n\nconst useBeforeUnload = () => {\n useEffect(() => {\n const handleBeforeUnload = () => {\n handleContinuousPlayback();\n };\n\n window.addEventListener(\"beforeunload\", handleBeforeUnload);\n return () => window.removeEventListener(\"beforeunload\", handleBeforeUnload);\n }, []);\n};\n\nexport default useBeforeUnload;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-video-player",
3
- "version": "3.0.13",
3
+ "version": "3.0.14",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.cjs",
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkMVNOUM3G_js=require('./chunk-MVNOUM3G.js');require('./chunk-K4YPVDEE.js'),require('./chunk-W5NVHMWX.js'),require('./chunk-ISVY5ION.js'),require('./chunk-AK5TFAW3.js'),require('./chunk-COYFW7R4.js'),require('./chunk-5UGSCO4K.js');var chunkVUHZVVMS_js=require('./chunk-VUHZVVMS.js'),chunkAN6JAJSI_js=require('./chunk-AN6JAJSI.js'),jsxRuntime=require('react/jsx-runtime');chunkAN6JAJSI_js.e();var l=()=>jsxRuntime.jsx("div",{className:`pl-w-full pl-aspect-video ${!chunkVUHZVVMS_js.t("isTouchScreen")&&!chunkVUHZVVMS_js.t("isFullScreen")&&"!pl-rounded-[12px]"}`,children:jsxRuntime.jsx(chunkMVNOUM3G_js.a,{})}),a=l;module.exports=a;//# sourceMappingURL=staticPlayer-7LS2DPUR.js.map
2
+ //# sourceMappingURL=staticPlayer-7LS2DPUR.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/videoPlayerLibrary/components/videoPlayer/staticPlayer/staticPlayer.tsx"],"names":["init_cjs_shims","StaticPlayer","jsx","conditions","videoArea_default","staticPlayer_default"],"mappings":"uYAAAA,kBAAAA,EAAAA,CAMA,IAAMC,CAAAA,CAAe,IAEjBC,cAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAW,CAAA,0BAAA,EACT,CAACC,kBAAAA,CAAAA,eAAsC,GACvC,CAACA,kBAAAA,CAAAA,cAAqC,CAAA,EACtC,oBACF,CAAA,CAAA,CAEA,QAAA,CAAAD,eAACE,kBAAAA,CAAA,EAAU,CAAA,CACb,CAAA,CAIGC,CAAAA,CAAQJ","file":"staticPlayer-TNS4JFRP.js","sourcesContent":["\"use client\";\n\nimport { conditions } from \"../../../helpers/conditions/conditions\";\nimport { ConditionName } from \"../../../helpers/interfaces/enums\";\nimport VideoArea from \"../../custom-components/videoArea/videoArea\";\n\nconst StaticPlayer = () => {\n return (\n <div\n className={`pl-w-full pl-aspect-video ${\n !conditions(ConditionName.isTouchScreen) &&\n !conditions(ConditionName.isFullScreen) &&\n \"!pl-rounded-[12px]\"\n }`}\n >\n <VideoArea />\n </div>\n );\n};\n\nexport default StaticPlayer;\n"]}
1
+ {"version":3,"sources":["../src/videoPlayerLibrary/components/videoPlayer/staticPlayer/staticPlayer.tsx"],"names":["init_cjs_shims","StaticPlayer","jsx","conditions","videoArea_default","staticPlayer_default"],"mappings":"uYAAAA,kBAAAA,EAAAA,CAMA,IAAMC,CAAAA,CAAe,IAEjBC,cAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAW,CAAA,0BAAA,EACT,CAACC,kBAAAA,CAAAA,eAAsC,GACvC,CAACA,kBAAAA,CAAAA,cAAqC,CAAA,EACtC,oBACF,CAAA,CAAA,CAEA,QAAA,CAAAD,eAACE,kBAAAA,CAAA,EAAU,CAAA,CACb,CAAA,CAIGC,CAAAA,CAAQJ","file":"staticPlayer-7LS2DPUR.js","sourcesContent":["\"use client\";\n\nimport { conditions } from \"../../../helpers/conditions/conditions\";\nimport { ConditionName } from \"../../../helpers/interfaces/enums\";\nimport VideoArea from \"../../custom-components/videoArea/videoArea\";\n\nconst StaticPlayer = () => {\n return (\n <div\n className={`pl-w-full pl-aspect-video ${\n !conditions(ConditionName.isTouchScreen) &&\n !conditions(ConditionName.isFullScreen) &&\n \"!pl-rounded-[12px]\"\n }`}\n >\n <VideoArea />\n </div>\n );\n};\n\nexport default StaticPlayer;\n"]}
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-SKRDEKL2.mjs';import'./chunk-GYUGYOVP.mjs';import'./chunk-Y7BIYTQP.mjs';import'./chunk-WU4GN63P.mjs';import'./chunk-2DV7FRU5.mjs';import'./chunk-XKRBXZUB.mjs';import'./chunk-CCO6GDG2.mjs';import {t}from'./chunk-BC4366GN.mjs';import {e}from'./chunk-4QMWBTB5.mjs';import {jsx}from'react/jsx-runtime';e();var l=()=>jsx("div",{className:`pl-w-full pl-aspect-video ${!t("isTouchScreen")&&!t("isFullScreen")&&"!pl-rounded-[12px]"}`,children:jsx(a,{})}),m=l;export{m as default};//# sourceMappingURL=staticPlayer-2IO6XEKM.mjs.map
2
- //# sourceMappingURL=staticPlayer-2IO6XEKM.mjs.map
1
+ import {a}from'./chunk-EPUUJE7V.mjs';import'./chunk-P4O3IKAQ.mjs';import'./chunk-P46UX5ND.mjs';import'./chunk-B2LB3L3X.mjs';import'./chunk-2DV7FRU5.mjs';import'./chunk-XKRBXZUB.mjs';import'./chunk-HOAJ3EFI.mjs';import {t}from'./chunk-NLCBOGTI.mjs';import {e}from'./chunk-4QMWBTB5.mjs';import {jsx}from'react/jsx-runtime';e();var l=()=>jsx("div",{className:`pl-w-full pl-aspect-video ${!t("isTouchScreen")&&!t("isFullScreen")&&"!pl-rounded-[12px]"}`,children:jsx(a,{})}),m=l;export{m as default};//# sourceMappingURL=staticPlayer-J7Q3JXQ2.mjs.map
2
+ //# sourceMappingURL=staticPlayer-J7Q3JXQ2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/videoPlayerLibrary/components/videoPlayer/staticPlayer/staticPlayer.tsx"],"names":["init_esm_shims","StaticPlayer","jsx","conditions","videoArea_default","staticPlayer_default"],"mappings":"iUAAAA,CAAAA,EAAAA,CAMA,IAAMC,CAAAA,CAAe,IAEjBC,GAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAW,CAAA,0BAAA,EACT,CAACC,CAAAA,CAAAA,eAAsC,GACvC,CAACA,CAAAA,CAAAA,cAAqC,CAAA,EACtC,oBACF,CAAA,CAAA,CAEA,QAAA,CAAAD,IAACE,CAAAA,CAAA,EAAU,CAAA,CACb,CAAA,CAIGC,CAAAA,CAAQJ","file":"staticPlayer-2IO6XEKM.mjs","sourcesContent":["\"use client\";\n\nimport { conditions } from \"../../../helpers/conditions/conditions\";\nimport { ConditionName } from \"../../../helpers/interfaces/enums\";\nimport VideoArea from \"../../custom-components/videoArea/videoArea\";\n\nconst StaticPlayer = () => {\n return (\n <div\n className={`pl-w-full pl-aspect-video ${\n !conditions(ConditionName.isTouchScreen) &&\n !conditions(ConditionName.isFullScreen) &&\n \"!pl-rounded-[12px]\"\n }`}\n >\n <VideoArea />\n </div>\n );\n};\n\nexport default StaticPlayer;\n"]}
1
+ {"version":3,"sources":["../src/videoPlayerLibrary/components/videoPlayer/staticPlayer/staticPlayer.tsx"],"names":["init_esm_shims","StaticPlayer","jsx","conditions","videoArea_default","staticPlayer_default"],"mappings":"iUAAAA,CAAAA,EAAAA,CAMA,IAAMC,CAAAA,CAAe,IAEjBC,GAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAW,CAAA,0BAAA,EACT,CAACC,CAAAA,CAAAA,eAAsC,GACvC,CAACA,CAAAA,CAAAA,cAAqC,CAAA,EACtC,oBACF,CAAA,CAAA,CAEA,QAAA,CAAAD,IAACE,CAAAA,CAAA,EAAU,CAAA,CACb,CAAA,CAIGC,CAAAA,CAAQJ","file":"staticPlayer-J7Q3JXQ2.mjs","sourcesContent":["\"use client\";\n\nimport { conditions } from \"../../../helpers/conditions/conditions\";\nimport { ConditionName } from \"../../../helpers/interfaces/enums\";\nimport VideoArea from \"../../custom-components/videoArea/videoArea\";\n\nconst StaticPlayer = () => {\n return (\n <div\n className={`pl-w-full pl-aspect-video ${\n !conditions(ConditionName.isTouchScreen) &&\n !conditions(ConditionName.isFullScreen) &&\n \"!pl-rounded-[12px]\"\n }`}\n >\n <VideoArea />\n </div>\n );\n};\n\nexport default StaticPlayer;\n"]}
@@ -1,2 +1,2 @@
1
- import {a,c,b as b$1,d}from'./chunk-4XKL6TLO.mjs';import {y,B,v,a as a$1,x,w,A as A$1,z as z$1}from'./chunk-73KLK4QU.mjs';import'./chunk-CCO6GDG2.mjs';import {qa,t,b,xa,c as c$1}from'./chunk-BC4366GN.mjs';import {e,z,A}from'./chunk-4QMWBTB5.mjs';import {useRef,useEffect}from'react';import {shallowEqual}from'react-redux';import I from'next/image';import {jsxs,jsx}from'react/jsx-runtime';e();var $=()=>{let c$2=z(),{params:t$1}=A(({videoData:{params:e}})=>({params:e}),shallowEqual);A(({controller:{firstPlay:e}})=>({firstPlay:e}),shallowEqual);let m=useRef(0),u=useRef(0),p=useRef(null),F=useRef(null),r=useRef(null);return useEffect(()=>{let e=r.current;if(!e)return;let n=()=>A$1(F,e),a=()=>z$1();return e.addEventListener("loadeddata",n),e.addEventListener("canplay",a),e.readyState>=2&&n(),e.readyState>=3&&a(),()=>{e.removeEventListener("loadeddata",n),e.removeEventListener("canplay",a);}},[]),useEffect(()=>{qa(m),u.current=Date.now();},[]),useEffect(()=>{let e=()=>{let n=r.current?.getBoundingClientRect();n&&c$2(c$1(n));};return t("isFirstPlay")&&e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t$1.id]),a(),useEffect(()=>{let e=r.current;if(!t$1.vhl_mainVideoSrc||!e)return;c$2(b({...t$1,id:t$1.vhl_mainVideoSrc}));let n=e.currentTime,a=()=>{e.currentTime=n,e.play().catch(()=>{e.muted=true,e.play();}),e.removeEventListener("canplay",a);};return e.addEventListener("canplay",a),e.src=t$1.vhl_mainVideoSrc+`?date=${Date.now()}`,e.load(),xa(e),()=>{e.removeEventListener("canplay",a);}},[t$1.vhl_mainVideoSrc]),c(),b$1(),d(),jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[t$1.banner&&jsx(I,{fill:true,src:t$1.banner,alt:t$1.bannerAlt??"\u0628\u0646\u0631 \u0648\u06CC\u062F\u06CC\u0648 \u067E\u0644\u06CC\u0631",style:{objectFit:"cover",pointerEvents:"none"}}),jsx("video",{playsInline:true,ref:r,id:"player-tag",preload:"metadata",crossOrigin:"anonymous",poster:t$1.banner??void 0,style:{width:"100%",height:"100%"},autoPlay:!!t("hasAutoPlay")||!!t$1.advertisement,className:`pl-w-full pl-h-full pl-items-center pl-flex-1 ${!t("isTouchScreen")&&!t("isFullScreen")&&"!pl-rounded-[12px]"}`,onError:a$1,onPause:v,onEnded:B,onTimeUpdate:y,onPlay:e=>w(e,p),onPlaying:e=>x(m,u,p,e.currentTarget),children:jsx("source",{src:t$1.id+`?date=${Date.now()}`})})]})},Z=$;export{Z as default};//# sourceMappingURL=staticVideoTag-2YYZBRPY.mjs.map
2
- //# sourceMappingURL=staticVideoTag-2YYZBRPY.mjs.map
1
+ import {a,c,b as b$1,d}from'./chunk-6LGS5W4B.mjs';import {y,B,v,a as a$1,x,w,A as A$1,z as z$1}from'./chunk-QFADUEGX.mjs';import'./chunk-HOAJ3EFI.mjs';import {qa,t,b,xa,c as c$1}from'./chunk-NLCBOGTI.mjs';import {e,z,A}from'./chunk-4QMWBTB5.mjs';import {useRef,useEffect}from'react';import {shallowEqual}from'react-redux';import I from'next/image';import {jsxs,jsx}from'react/jsx-runtime';e();var $=()=>{let c$2=z(),{params:t$1}=A(({videoData:{params:e}})=>({params:e}),shallowEqual);A(({controller:{firstPlay:e}})=>({firstPlay:e}),shallowEqual);let m=useRef(0),u=useRef(0),p=useRef(null),F=useRef(null),r=useRef(null);return useEffect(()=>{let e=r.current;if(!e)return;let n=()=>A$1(F,e),a=()=>z$1();return e.addEventListener("loadeddata",n),e.addEventListener("canplay",a),e.readyState>=2&&n(),e.readyState>=3&&a(),()=>{e.removeEventListener("loadeddata",n),e.removeEventListener("canplay",a);}},[]),useEffect(()=>{qa(m),u.current=Date.now();},[]),useEffect(()=>{let e=()=>{let n=r.current?.getBoundingClientRect();n&&c$2(c$1(n));};return t("isFirstPlay")&&e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t$1.id]),a(),useEffect(()=>{let e=r.current;if(!t$1.vhl_mainVideoSrc||!e)return;c$2(b({...t$1,id:t$1.vhl_mainVideoSrc}));let n=e.currentTime,a=()=>{e.currentTime=n,e.play().catch(()=>{e.muted=true,e.play();}),e.removeEventListener("canplay",a);};return e.addEventListener("canplay",a),e.src=t$1.vhl_mainVideoSrc+`?date=${Date.now()}`,e.load(),xa(e),()=>{e.removeEventListener("canplay",a);}},[t$1.vhl_mainVideoSrc]),c(),b$1(),d(),jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[t$1.banner&&jsx(I,{fill:true,src:t$1.banner,alt:t$1.bannerAlt??"\u0628\u0646\u0631 \u0648\u06CC\u062F\u06CC\u0648 \u067E\u0644\u06CC\u0631",style:{objectFit:"cover",pointerEvents:"none"}}),jsx("video",{playsInline:true,ref:r,id:"player-tag",preload:"metadata",crossOrigin:"anonymous",poster:t$1.banner??void 0,style:{width:"100%",height:"100%"},autoPlay:!!t("hasAutoPlay")||!!t$1.advertisement,className:`pl-w-full pl-h-full pl-items-center pl-flex-1 ${!t("isTouchScreen")&&!t("isFullScreen")&&"!pl-rounded-[12px]"}`,onError:a$1,onPause:v,onEnded:B,onTimeUpdate:y,onPlay:e=>w(e,p),onPlaying:e=>x(m,u,p,e.currentTarget),children:jsx("source",{src:t$1.id+`?date=${Date.now()}`})})]})},Z=$;export{Z as default};//# sourceMappingURL=staticVideoTag-JOPHGL3R.mjs.map
2
+ //# sourceMappingURL=staticVideoTag-JOPHGL3R.mjs.map