{"version":3,"sources":["webpack:///./Avensia.Common/Features/Shared/Video/VideoSource.tsx","webpack:///./Avensia.Common/Features/Shared/Video/VideoPlayer.tsx"],"names":["render","props","this","type","url","videoType","src","Component","sources","videoRef","autoPlay","loop","muted","isMobile","fixedVideo","coverContent","playsInline","playerRef","current","hlsSource","find","x","device","isSupported","hls","loadSource","attachMedia","on","Events","MANIFEST_PARSED","play","canPlayType","volume","className","ref","onEnded","style","width","zIndex","height","position","top","left","objectFit","objectPosition","filter","map","source","i","key"],"mappings":"uIA8Be,EArBf,yB,+CAmBA,OAnB0B,iBACxB,YAAAA,OAAA,WACE,IAAMC,EAAQC,KAAKD,MACXE,EAAA,EAAAA,KAAMC,EAAA,EAAAA,IACVC,EAAY,YAChB,OAAOF,GAEL,IAAK,MACHE,EAAY,wBACZ,MACF,IAAK,MACHA,EAAY,YAIhB,OACE,4BAAQC,IAAKF,EAAKD,KAAME,KAG9B,EAnBA,CAA0B,IAAME,WCoEjB,IA3DK,SAACN,G,MACXO,EAAA,EAAAA,QAASC,EAAA,EAAAA,SAAUC,EAAA,EAAAA,SAAUC,EAAA,EAAAA,KAAMC,EAAA,EAAAA,MAAOC,EAAA,EAAAA,SAAU,IAAAC,kBAAA,IAAa,GAAb,EAAoBC,EAAA,EAAAA,aAAcC,EAAA,EAAAA,YACxFC,EAAYR,GAAsB,iBAAyB,MA0BjE,OAxBA,qBAAU,W,MACR,GAAGQ,GAAaA,EAAUC,QAAS,CAEjC,IAAM,EAAQD,EAAUC,QAClBC,EAAmB,QAAV,EAAGX,SAAO,eAAEY,MAAK,SAAAC,GAAK,MAAW,QAAXA,EAAElB,OAAgC,QAAbkB,EAAEC,QAAoBD,EAAEC,UAAYT,EAAW,SAAW,eACpH,GAAIM,GAAa,IAAII,cAAe,CAClC,IAAIC,EAAM,IAAI,IACdA,EAAIC,WAAWN,EAAUf,KACzBoB,EAAIE,YAAY,GAChBF,EAAIG,GAAG,IAAIC,OAAOC,iBAAiB,WAC9BnB,GACD,EAAMoB,eAGDX,GAAa,EAAMY,YAAY,mCACxC,EAAMzB,IAAMa,EAAUf,KAGpBQ,IACF,EAAMoB,OAAS,OAGlB,IAGD,2BACEC,UAAU,cACVC,IAAKjB,EACLP,SAAUA,EACVC,KAAMA,EACNC,MAAOA,EACPI,YAAaA,EACbmB,QAASlC,EAAMkC,QACfC,MAAK,eACCrB,GAAgB,yBAClBsB,MAAO,QACHvB,EAAa,CAAEwB,QAAS,EAAGC,OAAQ,OAAQC,SAAU,QAASC,IAAK,EAAGC,KAAM,GAAM,CAAEH,OAAQ,SAAS,CACzGI,UAAW,QACXC,eAAgB,oBAIZ,QAHJ,EAGHpC,SAAO,eAAEqC,QAAO,SAAAxB,GAAK,MAAW,QAAXA,EAAElB,QAAgB2C,KAAI,SAACC,EAAQC,GACjD,OACsB,QAAlBD,EAAOzB,QACY,YAAlByB,EAAOzB,SAAyBT,GACd,WAAlBkC,EAAOzB,QAAuBT,IAA8B,QAAhBkC,EAAO5C,MAClD,kBAAC,EAAW,CAAC8C,IAAKD,EAAG7C,KAAM4C,EAAO5C,KAAMC,IAAK2C,EAAO3C","file":"assets/5.chunk.072f21f88b32a2e295c6.js","sourcesContent":["import React from 'react';\r\n\r\ntype ConnectedPropType = {\r\n type: string;\r\n url: string;\r\n};\r\n\r\ntype PropType = ConnectedPropType;\r\n\r\nclass VideoSource extends React.Component {\r\n render() {\r\n const props = this.props;\r\n const { type, url } = props;\r\n let videoType = 'video/mp4';\r\n switch(type)\r\n {\r\n case 'HLS':\r\n videoType = 'application/x-mpegURL';\r\n break;\r\n case 'MP4':\r\n videoType = 'video/mp4';\r\n break;\r\n }\r\n\r\n return (\r\n \r\n );\r\n }\r\n}\r\n\r\nexport default VideoSource;\r\n","import React, { useEffect, useRef } from 'react';\r\nimport VideoSourceType from 'Shared/ViewModels/VideoSourceViewModel.type';\r\nimport Hls from \"hls.js\";\r\nimport VideoSource from './VideoSource';\r\n\r\ntype VideoType = {\r\n videoRef?: React.MutableRefObject;\r\n autoPlay: boolean;\r\n loop: boolean;\r\n muted: boolean;\r\n isMobile: boolean;\r\n coverContent: boolean;\r\n playsInline: boolean;\r\n fixedVideo?: boolean;\r\n sources?: VideoSourceType[];\r\n onEnded?: () => void,\r\n};\r\n\r\nconst VideoPlayer = (props: VideoType) => {\r\n const { sources, videoRef, autoPlay, loop, muted, isMobile, fixedVideo = false, coverContent, playsInline } = props;\r\n const playerRef = videoRef ? videoRef : useRef(null);\r\n\r\n useEffect(() => {\r\n if(playerRef && playerRef.current) {\r\n\r\n const video = playerRef.current;\r\n const hlsSource = sources?.find(x => x.type === 'HLS' && (x.device === 'ALL' || x.device === (isMobile ? 'MOBILE' : 'DESKTOP')));\r\n if (hlsSource && Hls.isSupported()) {\r\n var hls = new Hls();\r\n hls.loadSource(hlsSource.url);\r\n hls.attachMedia(video);\r\n hls.on(Hls.Events.MANIFEST_PARSED, function() { \r\n if(autoPlay) {\r\n video.play();\r\n }\r\n });\r\n } else if (hlsSource && video.canPlayType('application/vnd.apple.mpegurl')) {\r\n video.src = hlsSource.url;\r\n }\r\n\r\n if(!muted) {\r\n video.volume = 0.5;\r\n }\r\n }\r\n }, []);\r\n \r\n return (\r\n \r\n {sources?.filter(x => x.type !== \"HLS\").map((source, i) => {\r\n return (\r\n ((source.device === 'ALL' ||\r\n (source.device === 'DESKTOP' && !isMobile) ||\r\n (source.device === 'MOBILE' && isMobile)) && source.type !== 'HLS') && (\r\n \r\n )\r\n );\r\n })} \r\n \r\n );\r\n};\r\n\r\nexport default VideoPlayer;\r\n\r\n"],"sourceRoot":""}