@cinecrew/cinecrew-player 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CineCrewPlayer.podspec +22 -0
- package/LICENSE +21 -0
- package/NOTICE +6 -0
- package/README.md +574 -0
- package/android/build.gradle +48 -0
- package/android/proguard-rules.pro +29 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/yuanzhou/vlc/ReactVlcPlayerPackage.java +28 -0
- package/android/src/main/java/com/yuanzhou/vlc/vlcplayer/ReactVlcPlayerView.java +988 -0
- package/android/src/main/java/com/yuanzhou/vlc/vlcplayer/ReactVlcPlayerViewManager.java +208 -0
- package/android/src/main/java/com/yuanzhou/vlc/vlcplayer/VideoEventEmitter.java +136 -0
- package/android/src/main/res/values/strings.xml +3 -0
- package/app.plugin.cjs +1 -0
- package/assets/cinecrew-player-logo.svg +44 -0
- package/package.json +132 -0
- package/packages/react-native-vlc-media-player/LICENSE +21 -0
- package/packages/react-native-vlc-media-player/VLCPlayer.js +207 -0
- package/packages/react-native-vlc-media-player/expo/android/withGradleTasks.cjs +49 -0
- package/packages/react-native-vlc-media-player/expo/ios/withMobileVlcKit.cjs +28 -0
- package/packages/react-native-vlc-media-player/expo/withVlcMediaPlayer.cjs +10 -0
- package/packages/react-native-vlc-media-player/index.d.ts +354 -0
- package/packages/react-native-vlc-media-player/ios/RCTVLCPlayer/RCTVLCPlayer.h +36 -0
- package/packages/react-native-vlc-media-player/ios/RCTVLCPlayer/RCTVLCPlayer.m +635 -0
- package/packages/react-native-vlc-media-player/ios/RCTVLCPlayer/RCTVLCPlayerManager.h +5 -0
- package/packages/react-native-vlc-media-player/ios/RCTVLCPlayer/RCTVLCPlayerManager.m +100 -0
- package/src/native/InlineLivePlayer.js +321 -0
- package/src/native/MediaPlayerView.js +3093 -0
- package/src/native/customization.js +44 -0
- package/src/native/index.js +107 -0
- package/src/native/media/ElectronVideoPlayer.js +288 -0
- package/src/native/media/EmojiPickerModal.js +30 -0
- package/src/native/media/LiveChatDrawer.js +1177 -0
- package/src/native/media/LiveRecordingOverlay.js +319 -0
- package/src/native/media/WebVideoPlayer.js +320 -0
- package/src/native/media/YouTubeVideoPlayer.native.js +120 -0
- package/src/native/media/YouTubeVideoPlayer.web.js +169 -0
- package/src/native/media/player/AudioOnlyView.js +337 -0
- package/src/native/media/player/CenterControls.js +94 -0
- package/src/native/media/player/ExoVideoFallback.js +329 -0
- package/src/native/media/player/PipOverlay.js +1 -0
- package/src/native/media/player/PlayerBottomBar.js +295 -0
- package/src/native/media/player/PlayerTopBar.js +255 -0
- package/src/native/media/player/VLCBoundary.js +41 -0
- package/src/native/media/player/VerticalIndicator.js +184 -0
- package/src/native/media/player/index.js +9 -0
- package/src/native/media/player/playerConstants.js +159 -0
- package/src/native/media/web/useWebAc3AudioPlayback.native.js +6 -0
- package/src/native/media/web/useWebAc3AudioPlayback.web.js +219 -0
- package/src/native/media/web/useWebHlsPlayback.native.js +3 -0
- package/src/native/media/web/useWebHlsPlayback.web.js +66 -0
- package/src/native/media/web/useWebMediaSession.js +90 -0
- package/src/native/media/web/useWebMpegTsPlayback.native.js +3 -0
- package/src/native/media/web/useWebMpegTsPlayback.web.js +356 -0
- package/src/native/media/web/useWebVideoAspectRatio.js +52 -0
- package/src/native/media/web/webPlaybackErrors.js +4 -0
- package/src/utils/layoutUtils.js +12 -0
- package/src/utils/mediaUtils.js +7 -0
- package/src/utils/recording.js +8 -0
- package/src/utils/runtimePlatform.js +19 -0
- package/src/utils/sourceUtils.js +99 -0
- package/src/utils/youtubeHtml.js +34 -0
- package/src/web/index.js +1129 -0
- package/src/web/styles.css +378 -0
- package/types/index.d.ts +268 -0
- package/vendor/mpegts.js/LICENSE +202 -0
- package/vendor/mpegts.js/mpegts.js +3 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function buildYouTubePlayerHtml(videoId, autoPlay = true) {
|
|
2
|
+
const id = String(videoId || '');
|
|
3
|
+
if (!/^[\w-]{11}$/.test(id)) throw new Error('A valid YouTube video ID is required.');
|
|
4
|
+
const autoplayFlag = autoPlay ? 1 : 0;
|
|
5
|
+
return `<!doctype html><html><head><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><style>html,body,#player{width:100%;height:100%;margin:0;background:#000;overflow:hidden}body{display:flex}</style></head><body><div id="player"></div><script>
|
|
6
|
+
(function(){
|
|
7
|
+
var player=null, state=-1;
|
|
8
|
+
function send(type, data){try{window.ReactNativeWebView.postMessage(JSON.stringify({type:type,data:data}));}catch(e){}}
|
|
9
|
+
window.cinecrewPlayerCommand=function(name,value){
|
|
10
|
+
if(!player)return;
|
|
11
|
+
try{
|
|
12
|
+
if(name==='play')player.playVideo();
|
|
13
|
+
else if(name==='pause')player.pauseVideo();
|
|
14
|
+
else if(name==='seek')player.seekTo(Number(value)||0,true);
|
|
15
|
+
else if(name==='seekRatio'){var duration=player.getDuration();if(duration>0)player.seekTo(duration*Math.max(0,Math.min(1,Number(value)||0)),true);}
|
|
16
|
+
else if(name==='mute')player.mute();
|
|
17
|
+
else if(name==='unmute')player.unMute();
|
|
18
|
+
else if(name==='volume')player.setVolume(Math.max(0,Math.min(100,Number(value)||0)));
|
|
19
|
+
else if(name==='rate')player.setPlaybackRate(Number(value)||1);
|
|
20
|
+
}catch(e){}
|
|
21
|
+
};
|
|
22
|
+
window.onYouTubeIframeAPIReady=function(){
|
|
23
|
+
player=new YT.Player('player',{width:'100%',height:'100%',videoId:'${id}',playerVars:{autoplay:${autoplayFlag},controls:0,playsinline:1,enablejsapi:1,rel:0,modestbranding:1,fs:0},events:{
|
|
24
|
+
onReady:function(){send('ready',{});if(${autoplayFlag})player.playVideo();},
|
|
25
|
+
onStateChange:function(event){state=event.data;send('state',{state:state});},
|
|
26
|
+
onError:function(event){send('error',{code:event.data});}
|
|
27
|
+
}});
|
|
28
|
+
};
|
|
29
|
+
var script=document.createElement('script');script.src='https://www.youtube.com/iframe_api';
|
|
30
|
+
document.head.appendChild(script);
|
|
31
|
+
setInterval(function(){if(player&&state===1){send('progress',{currentTime:player.getCurrentTime(),duration:player.getDuration()});}},500);
|
|
32
|
+
})();
|
|
33
|
+
</script></body></html>`;
|
|
34
|
+
}
|