From 02b1399463c7f6869aec4648f4d094aeb0f71192 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Sat, 23 Apr 2022 21:52:08 +0200 Subject: [PATCH 1/8] fix(android): allow multidex support --- examples/basic/android/app/build.gradle | 2 ++ .../app/src/main/java/com/videoplayer/MainApplication.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/basic/android/app/build.gradle b/examples/basic/android/app/build.gradle index 082873d4..dcde52e3 100644 --- a/examples/basic/android/app/build.gradle +++ b/examples/basic/android/app/build.gradle @@ -97,6 +97,7 @@ android { applicationId "com.videoplayer" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion + multiDexEnabled true versionCode 1 versionName "1.0" ndk { @@ -136,6 +137,7 @@ android { dependencies { implementation project(':react-native-video') + implementation 'com.android.support:multidex:1.0.3' implementation "com.facebook.react:react-native:+" // From node_modules implementation 'org.webkit:android-jsc:+' } diff --git a/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java b/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java index a2698415..382b9d8f 100644 --- a/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java +++ b/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java @@ -2,6 +2,7 @@ package com.videoplayer; import android.app.Application; +import androidx.multidex.MultiDexApplication; import com.facebook.react.ReactApplication; import com.brentvatne.react.ReactVideoPackage; import com.facebook.react.ReactNativeHost; @@ -12,7 +13,7 @@ import com.facebook.soloader.SoLoader; import java.util.Arrays; import java.util.List; -public class MainApplication extends Application implements ReactApplication { +public class MainApplication extends MultiDexApplication implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override From c56848c5b930ec1212f90a7ee6c320a379fe348c Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Sat, 23 Apr 2022 21:52:41 +0200 Subject: [PATCH 2/8] fix(android) : allow clearTextTraffic for easier testing --- examples/basic/android/app/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/basic/android/app/src/main/AndroidManifest.xml b/examples/basic/android/app/src/main/AndroidManifest.xml index 96fc8828..4f434091 100644 --- a/examples/basic/android/app/src/main/AndroidManifest.xml +++ b/examples/basic/android/app/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ android:allowBackup="true" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" + android:usesCleartextTraffic="true" android:theme="@style/AppTheme"> Date: Sat, 23 Apr 2022 22:14:38 +0200 Subject: [PATCH 3/8] fix: runtime issue --- .../app/src/main/java/com/videoplayer/MainApplication.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java b/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java index 382b9d8f..b2e0b019 100644 --- a/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java +++ b/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java @@ -28,6 +28,11 @@ public class MainApplication extends MultiDexApplication implements ReactApplica new ReactVideoPackage() ); } + + @Override + protected String getJSMainModuleName() { + return "index"; + } }; @Override From 89f6c406867487d8efca4f51eff261ebe66c7750 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Sat, 23 Apr 2022 22:15:11 +0200 Subject: [PATCH 4/8] fix(android): update build tools --- examples/basic/android/build.gradle | 12 ++++++------ .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/basic/android/build.gradle b/examples/basic/android/build.gradle index c2191278..c3fc996e 100644 --- a/examples/basic/android/build.gradle +++ b/examples/basic/android/build.gradle @@ -2,11 +2,11 @@ buildscript { ext { - buildToolsVersion = "28.0.3" - minSdkVersion = 16 - compileSdkVersion = 28 - targetSdkVersion = 28 - supportLibVersion = "28.0.0" + buildToolsVersion = "29.0.2" + minSdkVersion = 16 + compileSdkVersion = 31 + targetSdkVersion = 29 + supportLibVersion = "28.0.0" } repositories { @@ -14,7 +14,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.android.tools.build:gradle:4.0.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/examples/basic/android/gradle/wrapper/gradle-wrapper.properties b/examples/basic/android/gradle/wrapper/gradle-wrapper.properties index 364205fc..20553249 100644 --- a/examples/basic/android/gradle/wrapper/gradle-wrapper.properties +++ b/examples/basic/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip From a0c9b4e09054430a852f8dfec97caf934a57f832 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Sat, 23 Apr 2022 22:23:10 +0200 Subject: [PATCH 5/8] fix: move basic sample to typescript --- ...dex.android.js => VideoPlayer.android.tsx} | 28 +++++----- .../{index.ios.js => VideoPlayer.ios.tsx} | 36 +++++++------ ...dex.windows.js => VideoPlayer.windows.tsx} | 27 ++++++---- examples/basic/android/app/build.gradle | 2 +- examples/basic/index.js | 5 ++ examples/basic/ios/AppDelegate.m | 4 +- examples/basic/ios/VideoPlayer/AppDelegate.m | 2 +- examples/basic/ios/main.jsbundle | 2 +- examples/basic/package.json | 2 + examples/basic/tsconfig.json | 20 +++++++ examples/basic/windows/VideoPlayer/App.cpp | 2 +- .../windows/VideoPlayer/VideoPlayer.vcxproj | 2 +- examples/basic/yarn.lock | 53 +++++++++++++++---- 13 files changed, 128 insertions(+), 57 deletions(-) rename examples/basic/{index.android.js => VideoPlayer.android.tsx} (92%) rename examples/basic/{index.ios.js => VideoPlayer.ios.tsx} (95%) rename examples/basic/{index.windows.js => VideoPlayer.windows.tsx} (90%) create mode 100644 examples/basic/index.js create mode 100644 examples/basic/tsconfig.json diff --git a/examples/basic/index.android.js b/examples/basic/VideoPlayer.android.tsx similarity index 92% rename from examples/basic/index.android.js rename to examples/basic/VideoPlayer.android.tsx index 1242ddd0..927ac4bf 100644 --- a/examples/basic/index.android.js +++ b/examples/basic/VideoPlayer.android.tsx @@ -5,7 +5,6 @@ import React, { } from 'react'; import { - AppRegistry, StyleSheet, Text, TouchableOpacity, @@ -28,11 +27,11 @@ class VideoPlayer extends Component { video: Video; - onLoad = (data) => { + onLoad = (data: any) => { this.setState({ duration: data.duration }); }; - onProgress = (data) => { + onProgress = (data: any) => { this.setState({ currentTime: data.currentTime }); }; @@ -50,25 +49,25 @@ class VideoPlayer extends Component { }; getCurrentTimePercentage() { - if (this.state.currentTime > 0) { - return parseFloat(this.state.currentTime) / parseFloat(this.state.duration); + if (this.state.currentTime > 0 && this.state.duration !== 0) { + return this.state.currentTime / this.state.duration; } return 0; }; - renderRateControl(rate) { + renderRateControl(rate: number) { const isSelected = (this.state.rate === rate); return ( { this.setState({ rate }) }}> - {rate}x + {rate} ); } - renderResizeModeControl(resizeMode) { + renderResizeModeControl(resizeMode: string) { const isSelected = (this.state.resizeMode === resizeMode); return ( @@ -77,10 +76,10 @@ class VideoPlayer extends Component { {resizeMode} - ) + ) } - renderVolumeControl(volume) { + renderVolumeControl(volume: number) { const isSelected = (this.state.volume === volume); return ( @@ -121,7 +120,6 @@ class VideoPlayer extends Component { repeat={false} /> - @@ -225,6 +223,12 @@ const styles = StyleSheet.create({ paddingRight: 2, lineHeight: 12, }, + trackingControls: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', + }, }); -AppRegistry.registerComponent('VideoPlayer', () => VideoPlayer); +export default VideoPlayer \ No newline at end of file diff --git a/examples/basic/index.ios.js b/examples/basic/VideoPlayer.ios.tsx similarity index 95% rename from examples/basic/index.ios.js rename to examples/basic/VideoPlayer.ios.tsx index c4c21c3d..de6f328a 100644 --- a/examples/basic/index.ios.js +++ b/examples/basic/VideoPlayer.ios.tsx @@ -5,7 +5,6 @@ import React, { import { AlertIOS, - AppRegistry, Platform, StyleSheet, Text, @@ -35,7 +34,7 @@ const filterTypes = [ ]; class VideoPlayer extends Component { - constructor(props) { + constructor(props: any) { super(props); this.onLoad = this.onLoad.bind(this); this.onProgress = this.onProgress.bind(this); @@ -58,12 +57,12 @@ class VideoPlayer extends Component { filterEnabled: true }; - onLoad(data) { + onLoad(data: any) { console.log('On load fired!'); this.setState({duration: data.duration}); } - onProgress(data) { + onProgress(data: any) { this.setState({currentTime: data.currentTime}); } @@ -72,14 +71,14 @@ class VideoPlayer extends Component { } getCurrentTimePercentage() { - if (this.state.currentTime > 0) { - return parseFloat(this.state.currentTime) / parseFloat(this.state.duration); + if (this.state.currentTime > 0 && this.state.duration !== 0) { + return this.state.currentTime / this.state.duration; } else { return 0; } } - setFilter(step) { + setFilter(step: number) { let index = filterTypes.indexOf(this.state.filter) + step; if (index === filterTypes.length) { @@ -108,7 +107,7 @@ class VideoPlayer extends Component { ); } - renderRateControl(rate) { + renderRateControl(rate: number) { const isSelected = (this.state.rate == rate); return ( @@ -120,7 +119,7 @@ class VideoPlayer extends Component { ) } - renderResizeModeControl(resizeMode) { + renderResizeModeControl(resizeMode: string) { const isSelected = (this.state.resizeMode == resizeMode); return ( @@ -132,7 +131,7 @@ class VideoPlayer extends Component { ) } - renderVolumeControl(volume) { + renderVolumeControl(volume: number) { const isSelected = (this.state.volume == volume); return ( @@ -144,7 +143,7 @@ class VideoPlayer extends Component { ) } - renderIgnoreSilentSwitchControl(ignoreSilentSwitch) { + renderIgnoreSilentSwitchControl(ignoreSilentSwitch: string) { const isSelected = (this.state.ignoreSilentSwitch == ignoreSilentSwitch); return ( @@ -156,7 +155,7 @@ class VideoPlayer extends Component { ) } - renderMixWithOthersControl(mixWithOthers) { + renderMixWithOthersControl(mixWithOthers: string) { const isSelected = (this.state.mixWithOthers == mixWithOthers); return ( @@ -442,8 +441,13 @@ const styles = StyleSheet.create({ }, nativeVideoControls: { top: 184, - height: 300 - } + height: 300, + }, + trackingControls: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', + }, }); - -AppRegistry.registerComponent('VideoPlayer', () => VideoPlayer); +export default VideoPlayer diff --git a/examples/basic/index.windows.js b/examples/basic/VideoPlayer.windows.tsx similarity index 90% rename from examples/basic/index.windows.js rename to examples/basic/VideoPlayer.windows.tsx index a3d21c6f..4894a8ae 100644 --- a/examples/basic/index.windows.js +++ b/examples/basic/VideoPlayer.windows.tsx @@ -5,7 +5,6 @@ import React, { } from 'react'; import { - AppRegistry, StyleSheet, Text, TouchableOpacity, @@ -15,7 +14,7 @@ import { import Video from 'react-native-video'; class VideoPlayer extends Component { - constructor(props) { + constructor(props: any) { super(props); this.onLoad = this.onLoad.bind(this); this.onProgress = this.onProgress.bind(this); @@ -28,25 +27,26 @@ class VideoPlayer extends Component { resizeMode: 'contain', duration: 0.0, currentTime: 0.0, + paused: 0, }; - onLoad(data) { + onLoad(data: any) { this.setState({duration: data.duration}); } - onProgress(data) { + onProgress(data: any) { this.setState({currentTime: data.currentTime}); } getCurrentTimePercentage() { - if (this.state.currentTime > 0) { - return parseFloat(this.state.currentTime) / parseFloat(this.state.duration); + if (this.state.currentTime > 0 && this.state.duration !== 0) { + return this.state.currentTime / this.state.duration; } else { return 0; } } - renderRateControl(rate) { + renderRateControl(rate: number) { const isSelected = (this.state.rate == rate); return ( @@ -58,7 +58,7 @@ class VideoPlayer extends Component { ) } - renderResizeModeControl(resizeMode) { + renderResizeModeControl(resizeMode: string) { const isSelected = (this.state.resizeMode == resizeMode); return ( @@ -70,7 +70,7 @@ class VideoPlayer extends Component { ) } - renderVolumeControl(volume) { + renderVolumeControl(volume: number) { const isSelected = (this.state.volume == volume); return ( @@ -205,6 +205,11 @@ const styles = StyleSheet.create({ paddingRight: 2, lineHeight: 12, }, + trackingControls: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', + }, }); - -AppRegistry.registerComponent('VideoPlayer', () => VideoPlayer); +export default VideoPlayer diff --git a/examples/basic/android/app/build.gradle b/examples/basic/android/app/build.gradle index dcde52e3..c117dd5a 100644 --- a/examples/basic/android/app/build.gradle +++ b/examples/basic/android/app/build.gradle @@ -66,7 +66,7 @@ import com.android.build.OutputFile */ project.ext.react = [ - entryFile: "index.android.js", + entryFile: "index.js", enableHermes: false, ] apply from: "../../node_modules/react-native/react.gradle" diff --git a/examples/basic/index.js b/examples/basic/index.js new file mode 100644 index 00000000..d6ecd293 --- /dev/null +++ b/examples/basic/index.js @@ -0,0 +1,5 @@ +import VideoPlayer from './VideoPlayer'; + +import { AppRegistry } from 'react-native'; + +AppRegistry.registerComponent('VideoPlayer', () => VideoPlayer); diff --git a/examples/basic/ios/AppDelegate.m b/examples/basic/ios/AppDelegate.m index 74dbce6d..0e5653a5 100644 --- a/examples/basic/ios/AppDelegate.m +++ b/examples/basic/ios/AppDelegate.m @@ -26,12 +26,12 @@ // // To run on device, change `localhost` to the IP address of your computer, and make sure your computer and // iOS device are on the same Wi-Fi network. - jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; + jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.bundle?platform=ios&dev=true"]; // OPTION 2 // Load from pre-bundled file on disk. To re-generate the static bundle, run // - // $ curl 'http://localhost:8081/index.ios.bundle?dev=false&minify=true' -o iOS/main.jsbundle + // $ curl 'http://localhost:8081/index.bundle?dev=false&minify=true' -o iOS/main.jsbundle // // and uncomment the next following line // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; diff --git a/examples/basic/ios/VideoPlayer/AppDelegate.m b/examples/basic/ios/VideoPlayer/AppDelegate.m index 6c27cb41..31bf2249 100644 --- a/examples/basic/ios/VideoPlayer/AppDelegate.m +++ b/examples/basic/ios/VideoPlayer/AppDelegate.m @@ -18,7 +18,7 @@ { NSURL *jsCodeLocation; - jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; + jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"VideoPlayer" diff --git a/examples/basic/ios/main.jsbundle b/examples/basic/ios/main.jsbundle index 4f50ea33..5d7f29bf 100644 --- a/examples/basic/ios/main.jsbundle +++ b/examples/basic/ios/main.jsbundle @@ -1,5 +1,5 @@ // Offline JS // To re-generate the offline bundle, run this from root of your project -// $ curl 'http://localhost:8081/index.ios.bundle?dev=false&minify=true' -o iOS/main.jsbundle +// $ curl 'http://localhost:8081/index.bundle?dev=false&minify=true' -o iOS/main.jsbundle throw new Error('Offline JS file is empty. See iOS/main.jsbundle for instructions'); diff --git a/examples/basic/package.json b/examples/basic/package.json index 0b6e6292..3d7c9de8 100644 --- a/examples/basic/package.json +++ b/examples/basic/package.json @@ -18,6 +18,8 @@ "@babel/core": "^7.6.0", "@babel/runtime": "^7.6.0", "@react-native-community/eslint-config": "^0.0.5", + "@types/react": "^18.0.6", + "@types/react-native": "^0.67.6", "babel-jest": "^24.9.0", "eslint": "^6.4.0", "jest": "^24.9.0", diff --git a/examples/basic/tsconfig.json b/examples/basic/tsconfig.json new file mode 100644 index 00000000..70d85743 --- /dev/null +++ b/examples/basic/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "allowJs": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "isolatedModules": true, + "jsx": "react-native", + "lib": ["es2017"], + "moduleResolution": "node", + "noEmit": true, + "strict": true, + "target": "esnext" + }, + "exclude": [ + "node_modules", + "babel.config.js", + "metro.config.js", + "jest.config.js" + ] + } \ No newline at end of file diff --git a/examples/basic/windows/VideoPlayer/App.cpp b/examples/basic/windows/VideoPlayer/App.cpp index 9bc4bf46..7630a218 100644 --- a/examples/basic/windows/VideoPlayer/App.cpp +++ b/examples/basic/windows/VideoPlayer/App.cpp @@ -18,7 +18,7 @@ App::App() noexcept MainComponentName(L"VideoPlayer"); #if BUNDLE - JavaScriptBundleFile(L"index.windows"); + JavaScriptBundleFile(L"index"); InstanceSettings().UseWebDebugger(false); InstanceSettings().UseFastRefresh(false); #else diff --git a/examples/basic/windows/VideoPlayer/VideoPlayer.vcxproj b/examples/basic/windows/VideoPlayer/VideoPlayer.vcxproj index 6b91ab55..ebb90852 100644 --- a/examples/basic/windows/VideoPlayer/VideoPlayer.vcxproj +++ b/examples/basic/windows/VideoPlayer/VideoPlayer.vcxproj @@ -152,7 +152,7 @@ - npx --no-install react-native bundle --platform windows --entry-file index.js --bundle-output $(MSBuildThisFileDirectory)/Bundle/index.windows.bundle --assets-dest $(MSBuildThisFileDirectory)/Bundle + npx --no-install react-native bundle --platform windows --entry-file index.js --bundle-output $(MSBuildThisFileDirectory)/Bundle/index.bundle --assets-dest $(MSBuildThisFileDirectory)/Bundle True diff --git a/examples/basic/yarn.lock b/examples/basic/yarn.lock index d9970938..aa10ff13 100644 --- a/examples/basic/yarn.lock +++ b/examples/basic/yarn.lock @@ -1024,6 +1024,32 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636" integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A== +"@types/prop-types@*": + version "15.7.5" + resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf" + integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w== + +"@types/react-native@^0.67.6": + version "0.67.6" + resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.67.6.tgz#9a7de5feba6065aec9f44f9a1e8f6e55ee5d015c" + integrity sha512-NM6atxrefIXMLE/PyQ1bIQjQ/lWLdls3uVxItzKvNUUVZlGqgn/uGN4MarM9quSf90uSqJYPIAeAgTtBTUjhgg== + dependencies: + "@types/react" "*" + +"@types/react@*", "@types/react@^18.0.6": + version "18.0.6" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.6.tgz#30206c3830af6ce8639b91ace5868bc2d3d1d96c" + integrity sha512-bPqwzJRzKtfI0mVYr5R+1o9BOE8UEXefwc1LwcBtfnaAn6OoqMhLa/91VA8aeWfDPJt1kHvYKI8RHcQybZLHHA== + dependencies: + "@types/prop-types" "*" + "@types/scheduler" "*" + csstype "^3.0.2" + +"@types/scheduler@*": + version "0.16.2" + resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" + integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew== + "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" @@ -2002,6 +2028,11 @@ cssstyle@^1.0.0: dependencies: cssom "0.3.x" +csstype@^3.0.2: + version "3.0.11" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.11.tgz#d66700c5eacfac1940deb4e3ee5642792d85cd33" + integrity sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw== + dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -2180,10 +2211,10 @@ ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" -eme-encryption-scheme-polyfill@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/eme-encryption-scheme-polyfill/-/eme-encryption-scheme-polyfill-2.0.1.tgz#b080b01bffd74c75c9cf8044c1cabedf3b83954f" - integrity sha512-Wz+Ro1c0/2Wsx2RLFvTOO0m4LvYn+7cSnq3XOvRvLLBq8jbvUACH/zpU9s0/5+mQa5oaelkU69x+q0z/iWYrFA== +eme-encryption-scheme-polyfill@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/eme-encryption-scheme-polyfill/-/eme-encryption-scheme-polyfill-2.0.4.tgz#7d818302af3f3b19d5974255dcc92dc087413845" + integrity sha512-MHYJX1v145Pjj2YJTrVVuJOYyXrxGVy8LWf6kV5M4jrV/GyoeuJKyTuD+GaD+VAiE8Ip+MptiH4dXk6ZVmMNow== emoji-regex@^7.0.1: version "7.0.3" @@ -5378,11 +5409,11 @@ react-is@^16.8.4, react-is@^16.8.6: integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw== "react-native-video@file:../..": - version "5.1.0-alpha8" + version "5.2.0" dependencies: keymirror "^0.1.1" prop-types "^15.7.2" - shaka-player "^2.5.9" + shaka-player "^3.3.2" react-native-windows@^0.61.0-0: version "0.61.15" @@ -5940,12 +5971,12 @@ setprototypeof@1.1.1: resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== -shaka-player@^2.5.9: - version "2.5.18" - resolved "https://registry.yarnpkg.com/shaka-player/-/shaka-player-2.5.18.tgz#5382d0b879ade01dc7cea5115d311d2168b7428a" - integrity sha512-kW6sNMl36E4ookOcAo7//D/+sNkKNw7kBCR58AAC0eYw+fpVXwUbFoN/aqsj5nhACZ00QGQQajTZXZyK1s8Dow== +shaka-player@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/shaka-player/-/shaka-player-3.3.2.tgz#6c903413d64d0205d2c9672440f041233075e748" + integrity sha512-6N9J/Dy7xprT8xKcs9+YYiEJsXfKn3xtVzLndLRFP2hR13tn3YzVhP83hZmbnLzOEFBpuYlRq4kNrBNlOA+4/g== dependencies: - eme-encryption-scheme-polyfill "^2.0.1" + eme-encryption-scheme-polyfill "^2.0.3" shebang-command@^1.2.0: version "1.2.0" From da4ebcee78f97da0bcfaa2757b8373a9e90e13ff Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Sat, 23 Apr 2022 22:27:17 +0200 Subject: [PATCH 6/8] chore: add yarn android shortcut --- examples/basic/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/basic/package.json b/examples/basic/package.json index 3d7c9de8..dc67d012 100644 --- a/examples/basic/package.json +++ b/examples/basic/package.json @@ -4,6 +4,7 @@ "private": true, "scripts": { "start": "react-native start", + "android": "react-native run-android", "postinstall": "rm -rf node_modules/react-native-video/{examples,node_modules}", "test": "jest", "lint": "eslint ." From 2657441113a464814053c37cf1d127a3ffb793d8 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Sat, 23 Apr 2022 22:54:34 +0200 Subject: [PATCH 7/8] chore: fix bad default state --- examples/basic/VideoPlayer.android.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/basic/VideoPlayer.android.tsx b/examples/basic/VideoPlayer.android.tsx index 927ac4bf..01757ed8 100644 --- a/examples/basic/VideoPlayer.android.tsx +++ b/examples/basic/VideoPlayer.android.tsx @@ -22,7 +22,7 @@ class VideoPlayer extends Component { resizeMode: 'contain', duration: 0.0, currentTime: 0.0, - paused: true, + paused: false, }; video: Video; From 603956b893b5014ba5fcdf7ed2ee94fdf657cb76 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Tue, 26 Apr 2022 19:18:08 +0200 Subject: [PATCH 8/8] chore(sample): move source in source folder --- .../java/com/videoplayer/MainApplication.java | 2 +- examples/basic/babel.config.js | 13 +++ examples/basic/jsconfig.json | 18 +++++ examples/basic/package.json | 1 + .../basic/{ => src}/VideoPlayer.android.tsx | 0 examples/basic/{ => src}/VideoPlayer.ios.tsx | 0 .../basic/{ => src}/VideoPlayer.windows.tsx | 0 examples/basic/{ => src}/broadchurch.mp4 | Bin examples/basic/{ => src}/index.js | 0 examples/basic/yarn.lock | 74 ++++++++++++++++++ 10 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 examples/basic/jsconfig.json rename examples/basic/{ => src}/VideoPlayer.android.tsx (100%) rename examples/basic/{ => src}/VideoPlayer.ios.tsx (100%) rename examples/basic/{ => src}/VideoPlayer.windows.tsx (100%) rename examples/basic/{ => src}/broadchurch.mp4 (100%) rename examples/basic/{ => src}/index.js (100%) diff --git a/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java b/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java index b2e0b019..33c0d7da 100644 --- a/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java +++ b/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java @@ -31,7 +31,7 @@ public class MainApplication extends MultiDexApplication implements ReactApplica @Override protected String getJSMainModuleName() { - return "index"; + return "src/index"; } }; diff --git a/examples/basic/babel.config.js b/examples/basic/babel.config.js index f842b77f..e233168b 100644 --- a/examples/basic/babel.config.js +++ b/examples/basic/babel.config.js @@ -1,3 +1,16 @@ module.exports = { presets: ['module:metro-react-native-babel-preset'], + plugins: [ + [ + 'module-resolver', + { + extensions: ['.js', '.tsx', '.ts'], + root: ['./src'], + + alias: { + src: './src', + }, + }, + ], + ], }; diff --git a/examples/basic/jsconfig.json b/examples/basic/jsconfig.json new file mode 100644 index 00000000..068d5775 --- /dev/null +++ b/examples/basic/jsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "commonjs", + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "baseUrl": "./src", + "paths": { + "*": [ + "./src/*" + ] + } + }, + "exclude": [ + "node_modules", + "**/node_modules/*" + ] +} diff --git a/examples/basic/package.json b/examples/basic/package.json index dc67d012..6eebfe63 100644 --- a/examples/basic/package.json +++ b/examples/basic/package.json @@ -10,6 +10,7 @@ "lint": "eslint ." }, "dependencies": { + "babel-plugin-module-resolver": "^4.1.0", "react": "^16.12.0", "react-native": "0.61.5", "react-native-windows": "^0.61.0-0", diff --git a/examples/basic/VideoPlayer.android.tsx b/examples/basic/src/VideoPlayer.android.tsx similarity index 100% rename from examples/basic/VideoPlayer.android.tsx rename to examples/basic/src/VideoPlayer.android.tsx diff --git a/examples/basic/VideoPlayer.ios.tsx b/examples/basic/src/VideoPlayer.ios.tsx similarity index 100% rename from examples/basic/VideoPlayer.ios.tsx rename to examples/basic/src/VideoPlayer.ios.tsx diff --git a/examples/basic/VideoPlayer.windows.tsx b/examples/basic/src/VideoPlayer.windows.tsx similarity index 100% rename from examples/basic/VideoPlayer.windows.tsx rename to examples/basic/src/VideoPlayer.windows.tsx diff --git a/examples/basic/broadchurch.mp4 b/examples/basic/src/broadchurch.mp4 similarity index 100% rename from examples/basic/broadchurch.mp4 rename to examples/basic/src/broadchurch.mp4 diff --git a/examples/basic/index.js b/examples/basic/src/index.js similarity index 100% rename from examples/basic/index.js rename to examples/basic/src/index.js diff --git a/examples/basic/yarn.lock b/examples/basic/yarn.lock index aa10ff13..e8eef4ca 100644 --- a/examples/basic/yarn.lock +++ b/examples/basic/yarn.lock @@ -1473,6 +1473,17 @@ babel-plugin-jest-hoist@^24.9.0: dependencies: "@types/babel__traverse" "^7.0.6" +babel-plugin-module-resolver@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-4.1.0.tgz#22a4f32f7441727ec1fbf4967b863e1e3e9f33e2" + integrity sha512-MlX10UDheRr3lb3P0WcaIdtCSRlxdQsB1sBqL7W0raF070bGl1HQQq5K3T2vf2XAYie+ww+5AKC/WrkjRO2knA== + dependencies: + find-babel-config "^1.2.0" + glob "^7.1.6" + pkg-up "^3.1.0" + reselect "^4.0.0" + resolve "^1.13.1" + babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" @@ -2770,6 +2781,14 @@ finalhandler@1.1.2: statuses "~1.5.0" unpipe "~1.0.0" +find-babel-config@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/find-babel-config/-/find-babel-config-1.2.0.tgz#a9b7b317eb5b9860cda9d54740a8c8337a2283a2" + integrity sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA== + dependencies: + json5 "^0.5.1" + path-exists "^3.0.0" + find-cache-dir@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" @@ -2979,6 +2998,18 @@ glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.6: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + globals@^11.1.0, globals@^11.7.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" @@ -3308,6 +3339,13 @@ is-core-module@^2.1.0: dependencies: has "^1.0.3" +is-core-module@^2.8.1: + version "2.9.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" + integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== + dependencies: + has "^1.0.3" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -3985,6 +4023,11 @@ json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" +json5@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE= + json5@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" @@ -5192,6 +5235,11 @@ path-parse@^1.0.6: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + path-type@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" @@ -5239,6 +5287,13 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" +pkg-up@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5" + integrity sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA== + dependencies: + find-up "^3.0.0" + plist@^3.0.0, plist@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.1.tgz#a9b931d17c304e8912ef0ba3bdd6182baf2e1f8c" @@ -5700,6 +5755,11 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== +reselect@^4.0.0: + version "4.1.5" + resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.1.5.tgz#852c361247198da6756d07d9296c2b51eddb79f6" + integrity sha512-uVdlz8J7OO+ASpBYoz1Zypgx0KasCY20H+N8JD13oUMtPvSHQuscrHop4KbXrbsBcdB9Ds7lVK7eRkBIfO43vQ== + resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" @@ -5735,6 +5795,15 @@ resolve@^1.1.6: is-core-module "^2.1.0" path-parse "^1.0.6" +resolve@^1.13.1: + version "1.22.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" + integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== + dependencies: + is-core-module "^2.8.1" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + resolve@^1.3.2, resolve@^1.5.0: version "1.11.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232" @@ -6315,6 +6384,11 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + symbol-observable@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4"