From 8cc1dbda4fcb51e068fb2d3a5425048be0617402 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Wed, 9 Nov 2016 11:31:42 -0800 Subject: [PATCH 1/8] feat(Windows): Adds Windows support to react-native-video This PR adds react-native-windows support to react-native-video. The Video component is implemented with a XAML MediaPlayerElement. Most of the features implemented by Android (and some additional ones) are implemented by Windows. Known issues and missing features include: * onReadyForDisplay event * local URI convention (e.g., "broadchurch" in examples changed to require("./broadchurch.mp4") * `playableDuration` in `onVideoProgress` event is always 0.0 * `playInBackground` is not yet supported * Volume settings are applied, but the UWP control does not handle it properly --- README.md | 53 +++ Video.js | 2 +- example/index.windows.js | 210 +++++++++++ example/package.json | 6 +- example/windows/.gitignore | 89 +++++ example/windows/VideoPlayer.sln | 141 +++++++ example/windows/VideoPlayer/App.xaml | 8 + example/windows/VideoPlayer/App.xaml.cs | 112 ++++++ .../Assets/LockScreenLogo.scale-200.png | Bin 0 -> 1430 bytes .../Assets/SplashScreen.scale-200.png | Bin 0 -> 7700 bytes .../Assets/Square150x150Logo.scale-200.png | Bin 0 -> 2937 bytes .../Assets/Square44x44Logo.scale-200.png | Bin 0 -> 1647 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 1255 bytes .../windows/VideoPlayer/Assets/StoreLogo.png | Bin 0 -> 1451 bytes .../Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 3204 bytes example/windows/VideoPlayer/MainPage.cs | 55 +++ .../windows/VideoPlayer/Package.appxmanifest | 49 +++ .../VideoPlayer/Properties/AssemblyInfo.cs | 29 ++ .../VideoPlayer/Properties/Default.rd.xml | 31 ++ .../windows/VideoPlayer/VideoPlayer.csproj | 230 ++++++++++++ .../VideoPlayer/VideoPlayer_TemporaryKey.pfx | Bin 0 -> 2454 bytes example/windows/VideoPlayer/project.json | 17 + windows/.gitignore | 97 +++++ .../Properties/AssemblyInfo.cs | 29 ++ .../Properties/ReactNativeVideo.rd.xml | 33 ++ .../ReactNativeVideo/ReactNativeVideo.csproj | 116 ++++++ .../ReactNativeVideo/ReactVideoEventType.cs | 15 + .../ReactVideoEventTypeExtensions.cs | 36 ++ windows/ReactNativeVideo/ReactVideoPackage.cs | 30 ++ windows/ReactNativeVideo/ReactVideoView.cs | 355 ++++++++++++++++++ .../ReactNativeVideo/ReactVideoViewManager.cs | 137 +++++++ windows/ReactNativeVideo/project.json | 17 + 32 files changed, 1895 insertions(+), 2 deletions(-) create mode 100644 example/index.windows.js create mode 100644 example/windows/.gitignore create mode 100644 example/windows/VideoPlayer.sln create mode 100644 example/windows/VideoPlayer/App.xaml create mode 100644 example/windows/VideoPlayer/App.xaml.cs create mode 100644 example/windows/VideoPlayer/Assets/LockScreenLogo.scale-200.png create mode 100644 example/windows/VideoPlayer/Assets/SplashScreen.scale-200.png create mode 100644 example/windows/VideoPlayer/Assets/Square150x150Logo.scale-200.png create mode 100644 example/windows/VideoPlayer/Assets/Square44x44Logo.scale-200.png create mode 100644 example/windows/VideoPlayer/Assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 example/windows/VideoPlayer/Assets/StoreLogo.png create mode 100644 example/windows/VideoPlayer/Assets/Wide310x150Logo.scale-200.png create mode 100644 example/windows/VideoPlayer/MainPage.cs create mode 100644 example/windows/VideoPlayer/Package.appxmanifest create mode 100644 example/windows/VideoPlayer/Properties/AssemblyInfo.cs create mode 100644 example/windows/VideoPlayer/Properties/Default.rd.xml create mode 100644 example/windows/VideoPlayer/VideoPlayer.csproj create mode 100644 example/windows/VideoPlayer/VideoPlayer_TemporaryKey.pfx create mode 100644 example/windows/VideoPlayer/project.json create mode 100644 windows/.gitignore create mode 100644 windows/ReactNativeVideo/Properties/AssemblyInfo.cs create mode 100644 windows/ReactNativeVideo/Properties/ReactNativeVideo.rd.xml create mode 100644 windows/ReactNativeVideo/ReactNativeVideo.csproj create mode 100644 windows/ReactNativeVideo/ReactVideoEventType.cs create mode 100644 windows/ReactNativeVideo/ReactVideoEventTypeExtensions.cs create mode 100644 windows/ReactNativeVideo/ReactVideoPackage.cs create mode 100644 windows/ReactNativeVideo/ReactVideoView.cs create mode 100644 windows/ReactNativeVideo/ReactVideoViewManager.cs create mode 100644 windows/ReactNativeVideo/project.json diff --git a/README.md b/README.md index a6c0ed3f..4b718c34 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,59 @@ Under `.addPackage(new MainReactPackage())`: .addPackage(new ReactVideoPackage()) ``` +#### Windows + +Make the following additions to the given files manually: + +**windows/myapp.sln** + +Add the `ReactNativeVideo` project to your solution. +1. Open the solution in Visual Studio 2015 +2. Right-click Solution icon in Solution Explorer > Add > Existing Project... +3. Select `node_modules\react-native-video\windows\ReactNativeVideo\ReactNativeVideo.csproj` + +**windows/myapp/myapp.csproj** + +Add a reference to `ReactNativeVideo` to your main application project. + +Using Visual Studio 2015: +1. Right-click main application project > Add > Reference... +2. Check `ReactNativeVideo` from Solution Projects. + +Manually from `windows/myapp/myapp.csproj`, add: +```xml + + {e8f5f57f-757e-4237-ad23-f7a8755427cd} + ReactNativeVideo + +``` + +**MainPage.cs** + +Add the `ReactVideoPackage` class to your list of exported packages. +```cs +using ReactNative; +using ReactNative.Modules.Core; +using ReactNative.Shell; +using ReactNativeVideo; // <-- Add this +using System.Collections.Generic; +... + + public override List Packages + { + get + { + return new List + { + new MainReactPackage(), + new ReactVideoPackage(), // <-- Add this + }; + } + } + +... +``` + ## Usage ```javascript diff --git a/Video.js b/Video.js index 3c032f74..d5281523 100644 --- a/Video.js +++ b/Video.js @@ -125,7 +125,7 @@ export default class Video extends Component { } const isNetwork = !!(uri && uri.match(/^https?:/)); - const isAsset = !!(uri && uri.match(/^(assets-library|file|content):/)); + const isAsset = !!(uri && uri.match(/^(assets-library|file|content|ms-appx|ms-appdata):/)); let nativeResizeMode; if (resizeMode === VideoResizeMode.stretch) { diff --git a/example/index.windows.js b/example/index.windows.js new file mode 100644 index 00000000..a3d21c6f --- /dev/null +++ b/example/index.windows.js @@ -0,0 +1,210 @@ +'use strict'; + +import React, { + Component +} from 'react'; + +import { + AppRegistry, + StyleSheet, + Text, + TouchableOpacity, + View, +} from 'react-native'; + +import Video from 'react-native-video'; + +class VideoPlayer extends Component { + constructor(props) { + super(props); + this.onLoad = this.onLoad.bind(this); + this.onProgress = this.onProgress.bind(this); + } + + state = { + rate: 1, + volume: 1, + muted: false, + resizeMode: 'contain', + duration: 0.0, + currentTime: 0.0, + }; + + onLoad(data) { + this.setState({duration: data.duration}); + } + + onProgress(data) { + this.setState({currentTime: data.currentTime}); + } + + getCurrentTimePercentage() { + if (this.state.currentTime > 0) { + return parseFloat(this.state.currentTime) / parseFloat(this.state.duration); + } else { + return 0; + } + } + + renderRateControl(rate) { + const isSelected = (this.state.rate == rate); + + return ( + { this.setState({rate: rate}) }}> + + {rate}x + + + ) + } + + renderResizeModeControl(resizeMode) { + const isSelected = (this.state.resizeMode == resizeMode); + + return ( + { this.setState({resizeMode: resizeMode}) }}> + + {resizeMode} + + + ) + } + + renderVolumeControl(volume) { + const isSelected = (this.state.volume == volume); + + return ( + { this.setState({volume: volume}) }}> + + {volume * 100}% + + + ) + } + + render() { + const flexCompleted = this.getCurrentTimePercentage() * 100; + const flexRemaining = (1 - this.getCurrentTimePercentage()) * 100; + + return ( + + {this.setState({paused: !this.state.paused})}}> + + + + + + {this.renderRateControl(0.25)} + {this.renderRateControl(0.5)} + {this.renderRateControl(1.0)} + {this.renderRateControl(1.5)} + {this.renderRateControl(2.0)} + + + + {this.renderVolumeControl(0.5)} + {this.renderVolumeControl(1)} + {this.renderVolumeControl(1.5)} + + + + {this.renderResizeModeControl('cover')} + {this.renderResizeModeControl('contain')} + {this.renderResizeModeControl('stretch')} + + + + + + + + + + + + ); + } +} + + +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + backgroundColor: 'black', + }, + fullScreen: { + position: 'absolute', + top: 0, + left: 0, + bottom: 0, + right: 0, + }, + controls: { + backgroundColor: "transparent", + borderRadius: 5, + position: 'absolute', + bottom: 20, + left: 20, + right: 20, + }, + progress: { + flex: 1, + flexDirection: 'row', + borderRadius: 3, + overflow: 'hidden', + }, + innerProgressCompleted: { + height: 20, + backgroundColor: '#cccccc', + }, + innerProgressRemaining: { + height: 20, + backgroundColor: '#2C2C2C', + }, + generalControls: { + flex: 1, + flexDirection: 'row', + borderRadius: 4, + overflow: 'hidden', + paddingBottom: 10, + }, + rateControl: { + flex: 1, + flexDirection: 'row', + justifyContent: 'center', + }, + volumeControl: { + flex: 1, + flexDirection: 'row', + justifyContent: 'center', + }, + resizeModeControl: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', + }, + controlOption: { + alignSelf: 'center', + fontSize: 11, + color: "white", + paddingLeft: 2, + paddingRight: 2, + lineHeight: 12, + }, +}); + +AppRegistry.registerComponent('VideoPlayer', () => VideoPlayer); diff --git a/example/package.json b/example/package.json index 0dcf72d8..a620fb4e 100644 --- a/example/package.json +++ b/example/package.json @@ -8,6 +8,10 @@ "dependencies": { "react": "15.3.1", "react-native": "^0.33.0", - "react-native-video": "file:../" + "react-native-video": "file:../", + "react-native-windows": "^0.33.4" + }, + "devDependencies": { + "rnpm-plugin-windows": "^0.2.3" } } diff --git a/example/windows/.gitignore b/example/windows/.gitignore new file mode 100644 index 00000000..33d3fde2 --- /dev/null +++ b/example/windows/.gitignore @@ -0,0 +1,89 @@ +*AppPackages* +*BundleArtifacts* +*ReactAssets* + +#OS junk files +[Tt]humbs.db +*.DS_Store + +#Visual Studio files +*.[Oo]bj +*.user +*.aps +*.pch +*.vspscc +*.vssscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.[Cc]ache +*.ilk +*.log +*.lib +*.sbr +*.sdf +*.opensdf +*.opendb +*.unsuccessfulbuild +ipch/ +[Oo]bj/ +[Bb]in +[Dd]ebug*/ +[Rr]elease*/ +Ankh.NoLoad + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +#MonoDevelop +*.pidb +*.userprefs + +#Tooling +_ReSharper*/ +*.resharper +[Tt]est[Rr]esult* +*.sass-cache + +#Project files +[Bb]uild/ + +#Subversion files +.svn + +# Office Temp Files +~$* + +# vim Temp Files +*~ + +#NuGet +packages/ +*.nupkg + +#ncrunch +*ncrunch* +*crunch*.local.xml + +# visual studio database projects +*.dbmdl + +#Test files +*.testsettings + +#Other files +*.DotSettings +.vs/ +*project.lock.json diff --git a/example/windows/VideoPlayer.sln b/example/windows/VideoPlayer.sln new file mode 100644 index 00000000..3d10db9e --- /dev/null +++ b/example/windows/VideoPlayer.sln @@ -0,0 +1,141 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoPlayer", "VideoPlayer\VideoPlayer.csproj", "{A027BE54-D118-49A4-8D84-0666A2A93E64}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative", "..\node_modules\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj", "{C7673AD5-E3AA-468C-A5FD-FA38154E205C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChakraBridge", "..\node_modules\react-native-windows\ReactWindows\ChakraBridge\ChakraBridge.vcxproj", "{4B72C796-16D5-4E3A-81C0-3E36F531E578}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNativeVideo", "..\node_modules\react-native-video\windows\ReactNativeVideo\ReactNativeVideo.csproj", "{E8F5F57F-757E-4237-AD23-F7A8755427CD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + DebugBundle|ARM = DebugBundle|ARM + DebugBundle|x64 = DebugBundle|x64 + DebugBundle|x86 = DebugBundle|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + ReleaseBundle|ARM = ReleaseBundle|ARM + ReleaseBundle|x64 = ReleaseBundle|x64 + ReleaseBundle|x86 = ReleaseBundle|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Debug|ARM.ActiveCfg = Debug|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Debug|ARM.Build.0 = Debug|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Debug|ARM.Deploy.0 = Debug|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Debug|x64.ActiveCfg = Debug|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Debug|x64.Build.0 = Debug|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Debug|x64.Deploy.0 = Debug|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Debug|x86.ActiveCfg = Debug|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Debug|x86.Build.0 = Debug|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Debug|x86.Deploy.0 = Debug|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.DebugBundle|ARM.ActiveCfg = DebugBundle|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.DebugBundle|ARM.Build.0 = DebugBundle|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.DebugBundle|ARM.Deploy.0 = DebugBundle|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.DebugBundle|x64.ActiveCfg = DebugBundle|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.DebugBundle|x64.Build.0 = DebugBundle|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.DebugBundle|x64.Deploy.0 = DebugBundle|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.DebugBundle|x86.ActiveCfg = DebugBundle|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.DebugBundle|x86.Build.0 = DebugBundle|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.DebugBundle|x86.Deploy.0 = DebugBundle|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Release|ARM.ActiveCfg = Release|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Release|ARM.Build.0 = Release|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Release|ARM.Deploy.0 = Release|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Release|x64.ActiveCfg = Release|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Release|x64.Build.0 = Release|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Release|x64.Deploy.0 = Release|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Release|x86.ActiveCfg = Release|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Release|x86.Build.0 = Release|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.Release|x86.Deploy.0 = Release|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.ReleaseBundle|ARM.ActiveCfg = ReleaseBundle|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.ReleaseBundle|ARM.Build.0 = ReleaseBundle|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.ReleaseBundle|ARM.Deploy.0 = ReleaseBundle|ARM + {A027BE54-D118-49A4-8D84-0666A2A93E64}.ReleaseBundle|x64.ActiveCfg = ReleaseBundle|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.ReleaseBundle|x64.Build.0 = ReleaseBundle|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.ReleaseBundle|x64.Deploy.0 = ReleaseBundle|x64 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.ReleaseBundle|x86.ActiveCfg = ReleaseBundle|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.ReleaseBundle|x86.Build.0 = ReleaseBundle|x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64}.ReleaseBundle|x86.Deploy.0 = ReleaseBundle|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.ActiveCfg = Debug|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.Build.0 = Debug|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.ActiveCfg = Debug|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.Build.0 = Debug|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.ActiveCfg = Debug|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.Build.0 = Debug|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|ARM.ActiveCfg = Debug|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|ARM.Build.0 = Debug|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|x64.ActiveCfg = Debug|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|x64.Build.0 = Debug|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|x86.ActiveCfg = Debug|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|x86.Build.0 = Debug|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.ActiveCfg = Release|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.Build.0 = Release|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.ActiveCfg = Release|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.Build.0 = Release|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.ActiveCfg = Release|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.Build.0 = Release|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|ARM.ActiveCfg = Release|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|ARM.Build.0 = Release|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|x64.ActiveCfg = Release|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|x64.Build.0 = Release|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|x86.ActiveCfg = Release|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|x86.Build.0 = Release|x86 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.ActiveCfg = Debug|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.Build.0 = Debug|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.ActiveCfg = Debug|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.Build.0 = Debug|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.ActiveCfg = Debug|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.Build.0 = Debug|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|ARM.ActiveCfg = Debug|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|ARM.Build.0 = Debug|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x64.ActiveCfg = Debug|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x64.Build.0 = Debug|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x86.ActiveCfg = Debug|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x86.Build.0 = Debug|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.ActiveCfg = Release|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.Build.0 = Release|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.ActiveCfg = Release|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.Build.0 = Release|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.ActiveCfg = Release|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.Build.0 = Release|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|ARM.ActiveCfg = Release|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|ARM.Build.0 = Release|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x64.ActiveCfg = Release|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x64.Build.0 = Release|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x86.ActiveCfg = Release|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x86.Build.0 = Release|Win32 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Debug|ARM.ActiveCfg = Debug|ARM + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Debug|ARM.Build.0 = Debug|ARM + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Debug|x64.ActiveCfg = Debug|x64 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Debug|x64.Build.0 = Debug|x64 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Debug|x86.ActiveCfg = Debug|x86 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Debug|x86.Build.0 = Debug|x86 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.DebugBundle|ARM.ActiveCfg = Debug|ARM + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.DebugBundle|ARM.Build.0 = Debug|ARM + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.DebugBundle|x64.ActiveCfg = Debug|x64 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.DebugBundle|x64.Build.0 = Debug|x64 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.DebugBundle|x86.ActiveCfg = Debug|x86 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.DebugBundle|x86.Build.0 = Debug|x86 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Release|ARM.ActiveCfg = Release|ARM + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Release|ARM.Build.0 = Release|ARM + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Release|x64.ActiveCfg = Release|x64 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Release|x64.Build.0 = Release|x64 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Release|x86.ActiveCfg = Release|x86 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.Release|x86.Build.0 = Release|x86 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.ReleaseBundle|ARM.ActiveCfg = Release|ARM + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.ReleaseBundle|ARM.Build.0 = Release|ARM + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.ReleaseBundle|x64.ActiveCfg = Release|x64 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.ReleaseBundle|x64.Build.0 = Release|x64 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.ReleaseBundle|x86.ActiveCfg = Release|x86 + {E8F5F57F-757E-4237-AD23-F7A8755427CD}.ReleaseBundle|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/example/windows/VideoPlayer/App.xaml b/example/windows/VideoPlayer/App.xaml new file mode 100644 index 00000000..02a3efbb --- /dev/null +++ b/example/windows/VideoPlayer/App.xaml @@ -0,0 +1,8 @@ + + + diff --git a/example/windows/VideoPlayer/App.xaml.cs b/example/windows/VideoPlayer/App.xaml.cs new file mode 100644 index 00000000..491a7ce5 --- /dev/null +++ b/example/windows/VideoPlayer/App.xaml.cs @@ -0,0 +1,112 @@ +using ReactNative; +using System; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.UI.Core; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Navigation; + +namespace VideoPlayer +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + sealed partial class App : Application + { + private readonly ReactPage _reactPage; + + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + this.Suspending += OnSuspending; + this.Resuming += OnResuming; + + _reactPage = new MainPage(); + } + + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// + /// Details about the launch request and process. + protected override void OnLaunched(LaunchActivatedEventArgs e) + { + _reactPage.OnResume(Exit); + +#if DEBUG + if (System.Diagnostics.Debugger.IsAttached) + { + this.DebugSettings.EnableFrameRateCounter = true; + } + + SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = + AppViewBackButtonVisibility.Visible; +#endif + + Frame rootFrame = Window.Current.Content as Frame; + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == null) + { + _reactPage.OnCreate(e.Arguments); + + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame(); + + rootFrame.NavigationFailed += OnNavigationFailed; + + // Place the frame in the current Window + Window.Current.Content = rootFrame; + } + + if (rootFrame.Content == null) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Content = _reactPage; + } + + // Ensure the current window is active + Window.Current.Activate(); + } + + /// + /// Invoked when Navigation to a certain page fails + /// + /// The Frame which failed navigation + /// Details about the navigation failure + void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + { + throw new Exception("Failed to load Page " + e.SourcePageType.FullName); + } + + /// + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// + /// The source of the suspend request. + /// Details about the suspend request. + private void OnSuspending(object sender, SuspendingEventArgs e) + { + _reactPage.OnSuspend(); + } + + /// + /// Invoked when application execution is being resumed. + /// + /// The source of the resume request. + /// Details about the resume request. + private void OnResuming(object sender, object e) + { + _reactPage.OnResume(Exit); + } + } +} diff --git a/example/windows/VideoPlayer/Assets/LockScreenLogo.scale-200.png b/example/windows/VideoPlayer/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..735f57adb5dfc01886d137b4e493d7e97cf13af3 GIT binary patch literal 1430 zcmaJ>TTC2P7~aKltDttVHYH6u8Io4i*}3fO&d$gd*bA_<3j~&e7%8(eXJLfhS!M@! zKrliY>>6yT4+Kr95$!DoD(Qn-5TP|{V_KS`k~E6(LGS@#`v$hQo&^^BKsw3HIsZBT z_y6C2n`lK@apunKojRQ^(_P}Mgewt$(^BBKCTZ;*xa?J3wQ7~@S0lUvbcLeq1Bg4o zH-bvQi|wt~L7q$~a-gDFP!{&TQfc3fX*6=uHv* zT&1&U(-)L%Xp^djI2?~eBF2cxC@YOP$+9d?P&h?lPy-9M2UT9fg5jKm1t$m#iWE{M zIf%q9@;fyT?0UP>tcw-bLkz;s2LlKl2qeP0w zECS7Ate+Awk|KQ+DOk;fl}Xsy4o^CY=pwq%QAAKKl628_yNPsK>?A>%D8fQG6IgdJ ztnxttBz#NI_a@fk7SU`WtrpsfZsNs9^0(2a z@C3#YO3>k~w7?2hipBf{#b6`}Xw1hlG$yi?;1dDs7k~xDAw@jiI*+tc;t2Lflg&bM)0!Y;0_@=w%`LW^8DsYpS#-bLOklX9r?Ei}TScw|4DbpW%+7 zFgAI)f51s}{y-eWb|vrU-Ya!GuYKP)J7z#*V_k^Xo>4!1Yqj*m)x&0L^tg3GJbVAJ zJ-Pl$R=NAabouV=^z_t;^K*0AvFs!vYU>_<|I^#c?>>CR<(T?=%{;U=aI*SbZADLH z&(f2wz_Y0??Tf|g;?|1Znw6}6U43Q#qNRwv1vp9uFn1)V#*4p&%$mP9x&15^OaBiDS(XppT|z^>;B{PLVEbS3IFYV yGvCsSX*m literal 0 HcmV?d00001 diff --git a/example/windows/VideoPlayer/Assets/SplashScreen.scale-200.png b/example/windows/VideoPlayer/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..023e7f1feda78d5100569825acedfd213a0d84e9 GIT binary patch literal 7700 zcmeHLYj~4Yw%(;oxoEH#Kxq-eR|+VkP17b#Vk;?4QwkI+A{L04G+#<<(x#Un1#+h5>eArRq zTw$)ZvTWW_Y?bDho0nPVTh08+s`sp!j74rJTTtXIDww0SILedFv?sZ?yb@@}GN;#8 znk_b~Q(A0YR#uV4ef!osoV1M3;vQ8N$O|fStfgf$S5;ddUNv`tWtGjM;koG#N;7M< zP*84lnx(bn_KF&9Z5Ai$)#Cs3a|$OFw>WKCT$of*L7_CqQEinflT|W{JT+aKp-E0v zsxmYg)1(T>DROm+LN1eQw8}KCTp=C!$H7`PU!t9_Hw@TsTI2`udRZv*!a5`#A9hK6Y95L(CDUX&_@QxKV z_feX{UhA#ZWlvgpL$#w^D#lq`_A4AzDqd|Zv6y9PX&DNcN|l}_D^{q@GG&H^Pg583 z8FI6N8^H7b5WjGp;urW)d7F+_lcp%KsLX0viCmE(OHH+=%ZfD_=`voUuoUxFO^L;- z;!;2{g-YiiO6m4bs89OuF9!p{FGtH-f%8<2gY!h9s)4ciN%{Kh1+`}{^}M~+TDH9N z^Z5PlgVXMC&2&k*Hw^Lb9gny#ro$MOIxIt{+r)EA10$VR3 zanN8D{TUkl+v0CQ_>ZoHP<M-x#8@8ZiT#$Kh`(uRaX1g$Bg|qy$<#7 zSSAi{Nb8Y=lvNVeio+UGLCAtoLBfL`iOv`)yoJMDJBN>4IH@(l7YRF;61@>qq1iM9 zr@b#OC~SAxSle?5Pp8Z78{VO0YFr1x7kZU64Z23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GD=A6d*hze&l4D_wA~+O!56)BZTe_rEu}Ezi<4!kG|W#amBZ5{&XS2@6R~H z{9o^y*BkH4$~yX9U&@CgbOzX1bn9xqF|zh$Dh0Y5y*E0e90*$!ObrHY3Ok0`2=O~r zCuke6KrP9KOf?V(YDsM<6pX2nVoN%M$LT^q#FmtaF?1^27F*IcNX~XRB(|hCFvdcc zc)$=S-)acdk$g4?_>jRqxpI6M3vHZk?0c^3=byamYDNf;uB{3NlKW5IhnOS3DNkMV z?tK8?kJ}pmvp%&&eTVOVjHP`q34hN1@!aK}H(K!vI`~gf|Gv+FNEQD5Yd<~yX7k_l h&G-K)@HZb3BABY{)U1?^%I#E6`MGoTtustd{~yM6srvu` literal 0 HcmV?d00001 diff --git a/example/windows/VideoPlayer/Assets/Square150x150Logo.scale-200.png b/example/windows/VideoPlayer/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..af49fec1a5484db1d52a7f9b5ec90a27c7030186 GIT binary patch literal 2937 zcma)84OCO-8BSud5)jwMLRVKgX(S?$n?Ld|vrsm<$CF7)&zTbyy1FE5bU`Q17MRv`9ue$;R(@8kR;#vJ*IM0>cJIAOte!d7oRgdH zd%ySjdB6L9=gX^A6)VzH7p2l@v~3zJAMw|DFy#^)F@@F*`mqUn=Il>l)8_+ab;nOW{%+iPx z+s{Eu|&pIs)Z7{La9~?xKfyl z#43?gjEL15d4WbOZo#SiP%>DB^+BcnJ=7dHEe;r#G=tuw|ka z%q@}##Uh7;tc%L_64m(kHtw74ty%BJMb)_1)#S0j`)F8_1jF7vScpsnH=0V19bO8y zR`0SjIdCUo&=>JwMQF8KHA<{ODHTiQh}0^@5QRmCA?gOH6_H3K^-_sNB^RrdNuK-R zOO*vOrKCVvDwgUck`kF(E7j{I#iiN;b*ZdCt4m@HPA`EuEqGGf4%!K<;(=I=&Vyrw z%TwcWtxa}8mCZ%Cyf&ActJ6_$ox5z6-D!0-dvnRx6t7y3d+h6QYpKWO;8OdnvERo7 z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lz~2tCc@ z&x|tj;aH&1&9HwcJBcT`;{?a+pnej;M1HO(6Z{#J!cZA04hnFl;NXA+&`=7bjW_^o zfC40u3LMG?NdPtwGl>Tq6u}*QG)}-y;)lu-_>ee3kibW(69n0$0Zy!}9rQz%*v1iO zT9_H>99yIrSPYVy6^);rR}7Yo=J_T@hi+qhTZXnVWyf;JDYm5#eYLTxr*?kiNn!+Y zQ+LUkBafNJ#rH#C(?d5^;gw9o#%daEI{mA*LHPIHPU`#|H$hD zwm>0&+kahQ)E#%~k>&5@&#Vg82H?s%71=)(soi@174pi9--2{w{1$}Sz4zGn3Du&x bht0Iza^2ykEt4(epJ78uh5nDlX8(TxzDYwP literal 0 HcmV?d00001 diff --git a/example/windows/VideoPlayer/Assets/Square44x44Logo.scale-200.png b/example/windows/VideoPlayer/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..ce342a2ec8a61291ba76c54604aea7e9d20af11b GIT binary patch literal 1647 zcmaJ?eM}Q)7(e+G1Q(|`V9JhTI2>MkceK4;p;PR&$Pi?ejk3YQ_3o`S&|W_dsOZ8# zWPTt69g`t$ab`0cj-Y0yiBSOqmd)tG7G(}M5aP0_%&9TijB#&)I{zSE^4@#z^FF`l z`8{8`o%wlL(UI|y2!cdsuVamHH~H86F!*-15em4)NqUpCQM5?aoC_eCf@lV4wvF2a zjDQn1JBL69f&@2M3rvzJcfE!eZ8FZUBlFlC5RD)it33{mF9#B82AiyQE%w)`vlwa> zv{<1sm&kSKK$&%2jSFn7$t&P%%6Ue>R=EAnG8N7fqynWG8L3p!4801a;8{+nliO(qd(jNJ_?+9W3#hLIDLoT6~3fx9=`CC-D}-AMrpEO7HK zt3$GicGPc?GmDjy7K2P@La;eu4!$zWCZ`ym{Z$b zu-O6RM&K4JT|BIZB`E-gxqG%FzanI#+2FFmqHqXG7yxWB=w55RGOM)$xMb(>kSNR z2w=1AZi%z=AmG~yea~XaXJR!v7vLn(RUnELfiB1|6D84ICOS}^Zo2AdN}<&*h}G_u z{xZ!(%>tLT3J3<5XhWy-tg+6)0nmUUENLW8TWA{R6bgVd3X;anYFZ^IRis*_P-C-r z;i>%1^eL3UI2-{w8nuFFcs0e~7J{O2k^~Ce%+Ly4U?|=!0LH=t6()xi<^I-rs+9sF z*q{E-CxZbGPeu#a;XJwE;9S1?#R&uns>^0G3p`hEUF*v`M?@h%T%J%RChmD|EVydq zmHWh*_=S%emRC*mhxaVLzT@>Z2SX0u9v*DIJ@WC^kLVdlGV6LpK$KIrlJqc zpJ921)+3JJdTx|<`G&kXpKkjGJv=76R`yYIQ{#c-`%+`#V(7}Q;&@6U8!Td1`d;?N z_9mnI#?AA}4J!r)LN4!E-@H5eXauuB7TOawS>Y|{-P?NNx-lq+z1W-+y(;39P&&LP zL{N80?&=C*qKmdA^moMZRuPcD!B<*mq$ch=0Cnlitw#txRWhb3%TQvPqjkC`F69G4b! ze7z9MZ#+;_#l?H37UqUhDFb^l&s2{oM$3I0o^Q!yx;;V)QmCMo)Tb_ui|mit8MS?U zm##6$sZZ1$@|s%?l@>4Z<*Q}sRBSKMhb4I{e5LdEhsHIHTe8Bod5c>6QtT>$XgUBz z6MK`kO$=jmt@FqggOhJ5j~e@ygRbG;<{Vu)*+nn9aQeo0;$#j;|MS=S$&L?BeV25z xs3B`@=#`5TF{^6(A1rvdY@|-RtQ|iS5{tyX+wH?;n8E)G$kykv-D^wh{{!TZT%7;_ literal 0 HcmV?d00001 diff --git a/example/windows/VideoPlayer/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/example/windows/VideoPlayer/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000000000000000000000000000000000000..f6c02ce97e0a802b85f6021e822c89f8bf57d5cd GIT binary patch literal 1255 zcmaJ>TWs4@7*5+{G#S+&C!qC#> zf>5N3P6jO*Cz>ug*(_DmW=)kea&m$gZ^+nyiF`;j%w@}y8)>p*SH}C`m?DXeieF2U zyQHecc_L%Gh!7GMt+hG06y;+|p4>m~}PjA}rKViGiEnn7G0ZO<>G|7q;2?NwGCM3s?eued6%hd$B+ z*kQJ{#~$S=DFE(%=E+UkmlEI*%3llUf~8Ja9YU1Vui0IbGBkW_gHB%Rd&!!ioX zs40O?i9I{};kle7GMvE7(rk`la=gTI)47=>%?q@^iL-nUo3}h4S}N-KHn8t5mVP8w z&bSErwp+37 zNJJ8?a|{r5Q3R0Z5s-LB1WHOwYC@7pCHWND#cL1cZ?{kJ368_*(UDWUDyb<}0y@o# zfMF016iMWPCb6obAxT$JlB6(2DrlXDTB&!0`!m??4F(qWMhjVZo?JXQmz`1*58Z=& zcDmB|S-E@j?BoFGix0flckqdS4jsPNzhfWyWIM98GxcLs89C(~dw%$_t;JjX-SD}E zfiGV;{8Q%8r}w9x>EEigW81>`kvnU@pK)4+xk9@+bNj9L!AAZ@SZ@q|)&BmY3+HZx zul~BeG4|}-;L%cHViQGQX?^zFfO0&#cHwel=d`lH9sJ-@Sl@n*(8J2>%Ac`IxyY?Q z{=GhWvC#gu-~Ia7*n{=+;qM?Ul_wy1+u7ho;=`>EwP^g~R@{unBds`!#@}tluZQpS zm)M~nYEifJWJGx?_6DcTy>#uh%>!H9=hb^(v`=m3F1{L>db=<5_tm+_&knAQ2EU$s Mu9UqpbNZeC0BbUo^Z)<= literal 0 HcmV?d00001 diff --git a/example/windows/VideoPlayer/Assets/StoreLogo.png b/example/windows/VideoPlayer/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..7385b56c0e4d3c6b0efe3324aa1194157d837826 GIT binary patch literal 1451 zcmaJ>eN5D57_Z|bH;{0+1#mbl)eTU3{h)Wf7EZV?;HD@XL@{B`Ui%(2aMxQ~xdXSv z5nzWi(LW)U2=Vc-cY@s7nPt{i0hc6!7xN4NNHI#EQl>YNBy8l4%x9gr_W-j zEZMQmmTIy(>;lblRfh`dIyTgc9W5d!VP$L4(kKrN1c5G~(O_#xG zAJCNTstD^5SeXFB+&$h=ToJP2H>xr$iqPs-#O*;4(!Fjw25-!gEb*)mU}=)J;Iu>w zxK(5XoD0wrPSKQ~rbL^Cw6O_03*l*}i=ydbu7adJ6y;%@tjFeXIXT+ms30pmbOP%Q zX}S;+LBh8Tea~TSkHzvX6$rYb)+n&{kSbIqh|c7hmlxmwSiq5iVhU#iEQ<>a18|O^Sln-8t&+t`*{qBWo5M?wFM(JuimAOb5!K#D}XbslM@#1ZVz_;!9U zpfEpLAOz=0g@bd6Xj_ILi-x^!M}73h^o@}hM$1jflTs|Yuj9AL@A3<-?MV4!^4q`e z)fO@A;{9K^?W?DbnesnPr6kK>$zaKo&;FhFd(GYFCIU^T+OIMb%Tqo+P%oq(IdX7S zf6+HLO?7o0m+p>~Tp5UrXWh!UH!wZ5kv!E`_w)PTpI(#Iw{AS`gH4^b(bm^ZCq^FZ zY9DD7bH}rq9mg88+KgA$Zp!iWncuU2n1AuIa@=sWvUR-s`Qb{R*kk(SPU^`$6BXz8 zn#7yaFOIK%qGxyi`dYtm#&qqox0$h=pNi#u=M8zUG@bpiZ=3sT=1}Trr}39cC)H|v zbL?W)=&s4zrh)7>L(|cc%$1#!zfL?HjpeP%T+x_a+jZ16b^iKOHxFEX$7d|8${H-* zIrOJ5w&i$>*D>AKaIoYg`;{L@jM((Kt?$N$5OnuPqVvq**Nm}(f0wwOF%iX_Pba;V z;m@wxX&NcV3?<1+u?A{y_DIj7#m3Af1rCE)o`D&Y3}0%7E;iX1yMDiS)sh0wKi!36 zL!Wmq?P^Ku&rK~HJd97KkLTRl>ScGFYZNlYytWnhmuu|)L&ND8_PmkayQb{HOY640 bno1(wj@u8DCVuFR|31B*4ek@pZJqxCDDe1x literal 0 HcmV?d00001 diff --git a/example/windows/VideoPlayer/Assets/Wide310x150Logo.scale-200.png b/example/windows/VideoPlayer/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..288995b397fdbef1fb7e85afd71445d5de1952c5 GIT binary patch literal 3204 zcmbVPeQXow8NYmBd90>}0NP?GhXW~VaeThm=a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i z`}<>-Q?K0GN8!IYxeP1XKXO+jsJbp~o^);Bc;%b7Flpe7;1`Ny@3r7ZR;?R)aJt8C ziNlEC<@3f_lIV4TwV}&e;D!Ee5_|e#g0LUh=5vmYWYm7&2h*M>QPKvGh9-)wfMMW3 z8J9b%1k7dzPzO0_NGQy92BZ^FR6R~6;^6?lqO;-QUP4BY%cG%3vEhbm#>4vIhPBh3 z-+pZGjh$x%Hp{?=FHsMp0&wNPlj00us{&`1ZOZTqs8%4X&xH=UDr*xyBW(Zp&Em94 zf)ZSfn#yg0N)>!1kWdkqJ^S*z0FF5|fj&qcE#Na|%OY0$uO>!&hP+1ywfD_WXk@4J(?MBftK7>$Nvqh@tDuarN%PrTLQ2Uzysx>UV=V zk^RrDSvdQ?0;=hY67EgII-f4`t=+i*yS=Y~!XlqIy_4x&%+OdfbKOFPXS2X5%4R{N z$SQMX^AK6(fA Packages + { + get + { + return new List + { + new MainReactPackage(), + new ReactVideoPackage(), + }; + } + } + + public override bool UseDeveloperSupport + { + get + { +#if !BUNDLE || DEBUG + return true; +#else + return false; +#endif + } + } + } + +} diff --git a/example/windows/VideoPlayer/Package.appxmanifest b/example/windows/VideoPlayer/Package.appxmanifest new file mode 100644 index 00000000..be303ca5 --- /dev/null +++ b/example/windows/VideoPlayer/Package.appxmanifest @@ -0,0 +1,49 @@ + + + + + + + + + + VideoPlayer + React Native for UWP + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/example/windows/VideoPlayer/Properties/AssemblyInfo.cs b/example/windows/VideoPlayer/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..cb6ff6b7 --- /dev/null +++ b/example/windows/VideoPlayer/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("VideoPlayer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("VideoPlayer")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] \ No newline at end of file diff --git a/example/windows/VideoPlayer/Properties/Default.rd.xml b/example/windows/VideoPlayer/Properties/Default.rd.xml new file mode 100644 index 00000000..86952373 --- /dev/null +++ b/example/windows/VideoPlayer/Properties/Default.rd.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/example/windows/VideoPlayer/VideoPlayer.csproj b/example/windows/VideoPlayer/VideoPlayer.csproj new file mode 100644 index 00000000..96611032 --- /dev/null +++ b/example/windows/VideoPlayer/VideoPlayer.csproj @@ -0,0 +1,230 @@ + + + + + Debug + x86 + {A027BE54-D118-49A4-8D84-0666A2A93E64} + AppContainerExe + Properties + VideoPlayer + VideoPlayer + en-US + UAP + 10.0.14393.0 + 10.0.10586.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + VideoPlayer_TemporaryKey.pfx + + + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x86 + false + prompt + true + + + true + bin\x86\DebugBundle\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE + ;2008 + true + full + x86 + false + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x86 + false + prompt + true + true + + + bin\x86\ReleaseBundle\ + TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE + true + ;2008 + true + pdbonly + x86 + false + prompt + MinimumRecommendedRules.ruleset + true + true + + + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM + false + prompt + true + + + true + bin\ARM\DebugBundle\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE + ;2008 + true + full + ARM + false + prompt + MinimumRecommendedRules.ruleset + true + + + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM + false + prompt + true + true + + + bin\ARM\ReleaseBundle\ + TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE + true + ;2008 + true + pdbonly + ARM + false + prompt + MinimumRecommendedRules.ruleset + true + true + + + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x64 + false + prompt + true + + + true + bin\x64\DebugBundle\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE + ;2008 + true + full + x64 + false + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x64 + false + prompt + true + true + + + bin\x64\ReleaseBundle\ + TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE + true + ;2008 + true + pdbonly + x64 + false + prompt + MinimumRecommendedRules.ruleset + true + true + + + + + + + + App.xaml + + + + + + + Designer + + + + + + + + + + + + + + + + MSBuild:Compile + Designer + + + + + {e8f5f57f-757e-4237-ad23-f7a8755427cd} + ReactNativeVideo + + + {c7673ad5-e3aa-468c-a5fd-fa38154e205c} + ReactNative + + + + + PreserveNewest + + + + 14.0 + + + + \ No newline at end of file diff --git a/example/windows/VideoPlayer/VideoPlayer_TemporaryKey.pfx b/example/windows/VideoPlay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X^Y~1AKzEw7u7*vJzk5^ zPBf}^mFw(p+jv?uM)*4agj6Gth8!J{psz zr2p$k@0Y_Fb>W9ndvb}_yC8v|?GnG6h{Iq&001DX|A_?RDG39>2_OP$02K)mpbn6M zgNQ-~oB;?yWPpMoDuUFJ@r%feZA~4yQ~u`afGUDj04K-}hgZUZ7!X$72@=gDOn}pX zJ7Vzzya9hCs6YT9378|-ZRIlHiZDF{Ujcj&%^TrVhl@E*&!4=Bh;De`45JwRk+ zW?iN^&PFUg`P%!EOwZ06Yb7h3Nsel%ARmkM+N;MytJ}Yjbe1h(VJ5(*bZjli({_~| zF2;&=PzrO7?GcdGlew9hwE<7Mep&}qj4DXwDk^T{58yw2tLcHwV|fXSaS;bzzI~HH zzOKDna^uO?gfG=HEKsYiZ#f`4WcaAkf+#^)Z}mkv3Jn6_Lj_0<;zp`1E&zgC7!(9R zg4;}Xn{h*2I8Nk%VX+)&^slu<9urba5V*@Tn&DhsTQZ=-mjo7SnOXBK9JCl@R&+PJ zTRBBK|K?@uac=hd1N}3ZP5QMOH2=z}X#D2jb3gUZhL_~olZC$SZ%WkOBql#PH{V8G zi@H7Zr&N2~c+V00CeiR)<{5)qd;0BESLr95P(C2;aH+S{<4*Az;nsnNbq4<8`8qbA z8hXN*nNzRt-cR?==|->n@N2zmtavdjzpE+YPf{T&R^4t!*Lb;kPpJ3!71?z5nXO`; z8;)HzC;N1JM4v}kd{Qf=;@_-nq}O7CBW3IzvJKS3=@K6m**;Y%=I5LBIV)pGS@C0x zM}lJKus#RAI-*;^1s2d>YfHB;ao4jW?*8W&UIW?-ap15@yl9jNhTz23wd!@OYgr)& nNPCnSM4V?T6k`a3;-OhqjT_LVqQ5eE$7EPLEF49)|B(IzfpaF1 literal 0 HcmV?d00001 diff --git a/example/windows/VideoPlayer/project.json b/example/windows/VideoPlayer/project.json new file mode 100644 index 00000000..bf00b26b --- /dev/null +++ b/example/windows/VideoPlayer/project.json @@ -0,0 +1,17 @@ +{ + "dependencies": { + "Facebook.CSSLayout": "2.0.1-pre", + "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2" + }, + "frameworks": { + "uap10.0": {} + }, + "runtimes": { + "win10-arm": {}, + "win10-arm-aot": {}, + "win10-x86": {}, + "win10-x86-aot": {}, + "win10-x64": {}, + "win10-x64-aot": {} + } +} \ No newline at end of file diff --git a/windows/.gitignore b/windows/.gitignore new file mode 100644 index 00000000..74236826 --- /dev/null +++ b/windows/.gitignore @@ -0,0 +1,97 @@ +#Visual Studio files +*.[Oo]bj +*.user +*.aps +*.pch +*.vspscc +*.vssscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.tlog +*.bak +*.[Cc]ache +*.ilk +*.log +*.lib +*.sbr +*.sdf +*.opensdf +*.opendb +*.unsuccessfulbuild +*.lastbuildstate +ipch/ +[Oo]bj/ +[Bb]in +[Dd]ebug*/ +[Rr]elease*/ +*.tlog/ +Ankh.NoLoad +UpgradeLog.htm + +#MonoDevelop +*.pidb +*.userprefs + +#Tooling +_ReSharper*/ +*.resharper +[Tt]est[Rr]esult* +*.sass-cache + +#Project files +[Bb]uild/ + +#Subversion files +.svn + +# Office Temp Files +~$* + +# vim Temp Files +*~ + +#NuGet +packages/ +*.nupkg + +#ncrunch +*ncrunch* +*crunch*.local.xml + +# visual studio database projects +*.dbmdl + +#Test files +*.testsettings + +#Other files +*.DotSettings +.vs/ +.vscode/ +*project.lock.json + +#JavaScript files +*.jsbundle + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Build results +[Dd]ebugPublic/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Ll]og/ diff --git a/windows/ReactNativeVideo/Properties/AssemblyInfo.cs b/windows/ReactNativeVideo/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..1d4241b5 --- /dev/null +++ b/windows/ReactNativeVideo/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ReactNativeVideo")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ReactNativeVideo")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] \ No newline at end of file diff --git a/windows/ReactNativeVideo/Properties/ReactNativeVideo.rd.xml b/windows/ReactNativeVideo/Properties/ReactNativeVideo.rd.xml new file mode 100644 index 00000000..19ad73b1 --- /dev/null +++ b/windows/ReactNativeVideo/Properties/ReactNativeVideo.rd.xml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/windows/ReactNativeVideo/ReactNativeVideo.csproj b/windows/ReactNativeVideo/ReactNativeVideo.csproj new file mode 100644 index 00000000..8ed6402e --- /dev/null +++ b/windows/ReactNativeVideo/ReactNativeVideo.csproj @@ -0,0 +1,116 @@ + + + + + Debug + AnyCPU + {E8F5F57F-757E-4237-AD23-F7A8755427CD} + Library + Properties + ReactNativeVideo + ReactNativeVideo + en-US + UAP + 10.0.14393.0 + 10.0.10586.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + x86 + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x86 + false + prompt + + + x86 + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x86 + false + prompt + + + ARM + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM + false + prompt + + + ARM + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM + false + prompt + + + x64 + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x64 + false + prompt + + + x64 + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x64 + false + prompt + + + + + + + + + + + + + + + + + {c7673ad5-e3aa-468c-a5fd-fa38154e205c} + ReactNative + + + + 14.0 + + + + \ No newline at end of file diff --git a/windows/ReactNativeVideo/ReactVideoEventType.cs b/windows/ReactNativeVideo/ReactVideoEventType.cs new file mode 100644 index 00000000..dd3f3feb --- /dev/null +++ b/windows/ReactNativeVideo/ReactVideoEventType.cs @@ -0,0 +1,15 @@ +namespace ReactNativeVideo +{ + enum ReactVideoEventType + { + LoadStart, + Load, + Error, + Progress, + Seek, + End, + Stalled, + Resume, + ReadyForDisplay, + } +} diff --git a/windows/ReactNativeVideo/ReactVideoEventTypeExtensions.cs b/windows/ReactNativeVideo/ReactVideoEventTypeExtensions.cs new file mode 100644 index 00000000..5f2b63db --- /dev/null +++ b/windows/ReactNativeVideo/ReactVideoEventTypeExtensions.cs @@ -0,0 +1,36 @@ +using System; +using static System.FormattableString; + +namespace ReactNativeVideo +{ + static class ReactVideoEventTypeExtensions + { + public static string GetEventName(this ReactVideoEventType eventType) + { + switch (eventType) + { + case ReactVideoEventType.LoadStart: + return "onVideoLoadStart"; + case ReactVideoEventType.Load: + return "onVideoLoad"; + case ReactVideoEventType.Error: + return "onVideoError"; + case ReactVideoEventType.Progress: + return "onVideoProgress"; + case ReactVideoEventType.Seek: + return "onVideoSeek"; + case ReactVideoEventType.End: + return "onVideoEnd"; + case ReactVideoEventType.Stalled: + return "onPlaybackStalled"; + case ReactVideoEventType.Resume: + return "onPlaybackResume"; + case ReactVideoEventType.ReadyForDisplay: + return "onReadyForDisplay"; + default: + throw new NotSupportedException( + Invariant($"No event name added for event type '{eventType}'.")); + } + } + } +} diff --git a/windows/ReactNativeVideo/ReactVideoPackage.cs b/windows/ReactNativeVideo/ReactVideoPackage.cs new file mode 100644 index 00000000..b8cc654b --- /dev/null +++ b/windows/ReactNativeVideo/ReactVideoPackage.cs @@ -0,0 +1,30 @@ +using ReactNative.Bridge; +using ReactNative.Modules.Core; +using ReactNative.UIManager; +using System; +using System.Collections.Generic; + +namespace ReactNativeVideo +{ + public class ReactVideoPackage : IReactPackage + { + public IReadOnlyList CreateJavaScriptModulesConfig() + { + return Array.Empty(); + } + + public IReadOnlyList CreateNativeModules(ReactContext reactContext) + { + return Array.Empty(); + + } + + public IReadOnlyList CreateViewManagers(ReactContext reactContext) + { + return new List + { + new ReactVideoViewManager(), + }; + } + } +} diff --git a/windows/ReactNativeVideo/ReactVideoView.cs b/windows/ReactNativeVideo/ReactVideoView.cs new file mode 100644 index 00000000..2e02bf67 --- /dev/null +++ b/windows/ReactNativeVideo/ReactVideoView.cs @@ -0,0 +1,355 @@ +using Newtonsoft.Json.Linq; +using ReactNative.UIManager; +using ReactNative.UIManager.Events; +using System; +using Windows.ApplicationModel.Core; +using Windows.Media.Core; +using Windows.Media.Playback; +using Windows.UI.Core; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace ReactNativeVideo +{ + class ReactVideoView : MediaPlayerElement, IDisposable + { + public const string EVENT_PROP_SEEK_TIME = "seekTime"; + + private readonly DispatcherTimer _timer; + + private bool _isSourceSet; + + private string _uri; + private bool _isLoopingEnabled; + private bool _isPaused; + private bool _isMuted; + private bool _isUserControlEnabled; + private bool _isCompleted; + private double _volume; + private double _rate; + + public ReactVideoView() + { + _timer = new DispatcherTimer(); + _timer.Interval = TimeSpan.FromMilliseconds(250.0); + _timer.Start(); + } + + public new string Source + { + set + { + _uri = value; + base.Source = MediaSource.CreateFromUri(new Uri(_uri)); + _isSourceSet = true; + ApplyModifiers(); + SubscribeEvents(); + } + } + + public bool IsLoopingEnabled + { + set + { + _isLoopingEnabled = value; + if (_isSourceSet) + { + MediaPlayer.IsLoopingEnabled = _isLoopingEnabled; + } + } + } + + public bool IsMuted + { + set + { + _isMuted = value; + if (_isSourceSet) + { + MediaPlayer.IsMuted = _isMuted; + } + } + } + + public bool IsPaused + { + set + { + _isPaused = value; + if (_isSourceSet) + { + if (_isPaused) + { + MediaPlayer.Pause(); + } + else + { + MediaPlayer.Play(); + } + } + } + } + + public bool IsUserControlEnabled + { + set + { + _isUserControlEnabled = value; + if (_isSourceSet) + { + MediaPlayer.SystemMediaTransportControls.IsEnabled = _isUserControlEnabled; + } + } + } + + public double Volume + { + set + { + _volume = value; + if (_isSourceSet) + { + MediaPlayer.Volume = _volume; + } + } + } + + public double Rate + { + set + { + _rate = value; + if (_isSourceSet) + { + MediaPlayer.PlaybackSession.PlaybackRate = _rate; + } + } + } + + public double ProgressUpdateInterval + { + set + { + _timer.Interval = TimeSpan.FromSeconds(value); + } + } + + public void Seek(double seek) + { + if (_isSourceSet) + { + MediaPlayer.PlaybackSession.Position = TimeSpan.FromSeconds(seek); + } + } + + public void Dispose() + { + if (_isSourceSet) + { + _timer.Tick -= OnTick; + MediaPlayer.SourceChanged -= OnSourceChanged; + MediaPlayer.MediaOpened -= OnMediaOpened; + MediaPlayer.MediaFailed -= OnMediaFailed; + MediaPlayer.MediaEnded -= OnMediaEnded; + MediaPlayer.PlaybackSession.BufferingStarted -= OnBufferingStarted; + MediaPlayer.PlaybackSession.BufferingEnded -= OnBufferingEnded; + MediaPlayer.PlaybackSession.SeekCompleted -= OnSeekCompleted; + } + + _timer.Stop(); + } + + private void ApplyModifiers() + { + IsLoopingEnabled = _isLoopingEnabled; + IsMuted = _isMuted; + IsPaused = _isPaused; + IsUserControlEnabled = _isUserControlEnabled; + Volume = _volume; + Rate = _rate; + } + + private void SubscribeEvents() + { + _timer.Tick += OnTick; + MediaPlayer.SourceChanged += OnSourceChanged; + MediaPlayer.MediaOpened += OnMediaOpened; + MediaPlayer.MediaFailed += OnMediaFailed; + MediaPlayer.MediaEnded += OnMediaEnded; + MediaPlayer.PlaybackSession.BufferingStarted += OnBufferingStarted; + MediaPlayer.PlaybackSession.BufferingEnded += OnBufferingEnded; + MediaPlayer.PlaybackSession.SeekCompleted += OnSeekCompleted; + } + + private void OnTick(object sender, object e) + { + if (_isSourceSet && !_isCompleted && !_isPaused) + { + this.GetReactContext() + .GetNativeModule() + .EventDispatcher + .DispatchEvent( + new ReactVideoEvent( + ReactVideoEventType.Progress.GetEventName(), + this.GetTag(), + new JObject + { + { "currentTime", MediaPlayer.PlaybackSession.Position.TotalSeconds }, + { "playableDuration", 0.0 /* TODO */ } + })); + } + } + + private void OnSourceChanged(MediaPlayer sender, object args) + { + this.GetReactContext() + .GetNativeModule() + .EventDispatcher + .DispatchEvent( + new ReactVideoEvent( + ReactVideoEventType.LoadStart.GetEventName(), + this.GetTag(), + new JObject + { + { "src", this._uri } + })); + } + + private void OnMediaOpened(MediaPlayer sender, object args) + { + RunOnDispatcher(delegate + { + var width = MediaPlayer.PlaybackSession.NaturalVideoWidth; + var height = MediaPlayer.PlaybackSession.NaturalVideoHeight; + var orientation = (width > height) ? "landscape" : "portrait"; + var size = new JObject + { + { "width", width }, + { "height", height }, + { "orientation", orientation } + }; + + this.GetReactContext().GetNativeModule().EventDispatcher.DispatchEvent(new ReactVideoView.ReactVideoEvent(ReactVideoEventType.Load.GetEventName(), this.GetTag(), new JObject + { + { "duration", MediaPlayer.PlaybackSession.NaturalDuration.TotalSeconds }, + { "currentTime", MediaPlayer.PlaybackSession.Position.TotalSeconds }, + { "naturalSize", size }, + { "canPlayFastForward", false }, + { "canPlaySlowForward", false }, + { "canPlaySlow", false }, + { "canPlayReverse", false }, + { "canStepBackward", false }, + { "canStepForward", false } + })); + }); + } + + private void OnMediaFailed(MediaPlayer sender, MediaPlayerFailedEventArgs args) + { + var errorData = new JObject + { + { "what", args.Error.ToString() }, + { "extra", args.ErrorMessage } + }; + + this.GetReactContext() + .GetNativeModule() + .EventDispatcher + .DispatchEvent( + new ReactVideoEvent( + ReactVideoEventType.Error.GetEventName(), + this.GetTag(), + new JObject + { + { "error", errorData } + })); + } + + private void OnMediaEnded(MediaPlayer sender, object args) + { + _isCompleted = true; + this.GetReactContext() + .GetNativeModule() + .EventDispatcher + .DispatchEvent( + new ReactVideoEvent( + ReactVideoEventType.End.GetEventName(), + this.GetTag(), + null)); + } + + private void OnBufferingStarted(MediaPlaybackSession sender, object args) + { + this.GetReactContext() + .GetNativeModule() + .EventDispatcher + .DispatchEvent( + new ReactVideoEvent( + ReactVideoEventType.Stalled.GetEventName(), + this.GetTag(), + new JObject())); + } + + private void OnBufferingEnded(MediaPlaybackSession sender, object args) + { + this.GetReactContext() + .GetNativeModule() + .EventDispatcher + .DispatchEvent( + new ReactVideoEvent( + ReactVideoEventType.Resume.GetEventName(), + this.GetTag(), + new JObject())); + } + + private void OnSeekCompleted(MediaPlaybackSession sender, object args) + { + this.GetReactContext() + .GetNativeModule() + .EventDispatcher.DispatchEvent( + new ReactVideoEvent( + ReactVideoEventType.Seek.GetEventName(), + this.GetTag(), + new JObject())); + } + + private static async void RunOnDispatcher(DispatchedHandler action) + { + await CoreApplication.GetCurrentView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, action).AsTask().ConfigureAwait(false); + } + + class ReactVideoEvent : Event + { + private readonly string _eventName; + private readonly JObject _eventData; + + public ReactVideoEvent(string eventName, int viewTag, JObject eventData) + : base(viewTag, TimeSpan.FromTicks(Environment.TickCount)) + { + _eventName = eventName; + _eventData = eventData; + } + + public override string EventName + { + get + { + return _eventName; + } + } + + public override bool CanCoalesce + { + get + { + return false; + } + } + + public override void Dispatch(RCTEventEmitter eventEmitter) + { + eventEmitter.receiveEvent(ViewTag, EventName, _eventData); + } + } + } +} diff --git a/windows/ReactNativeVideo/ReactVideoViewManager.cs b/windows/ReactNativeVideo/ReactVideoViewManager.cs new file mode 100644 index 00000000..e93456c3 --- /dev/null +++ b/windows/ReactNativeVideo/ReactVideoViewManager.cs @@ -0,0 +1,137 @@ +using Newtonsoft.Json.Linq; +using ReactNative.UIManager; +using ReactNative.UIManager.Annotations; +using System; +using System.Collections.Generic; +using System.Linq; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Media; + +namespace ReactNativeVideo +{ + class ReactVideoViewManager : SimpleViewManager + { + public override string Name + { + get + { + return "RCTVideo"; + } + } + + public override IReadOnlyDictionary ExportedViewConstants + { + get + { + return new Dictionary + { + { "ScaleNone", ((int)Stretch.None).ToString() }, + { "ScaleToFill", ((int)Stretch.UniformToFill).ToString() }, + { "ScaleAspectFit", ((int)Stretch.Uniform).ToString() }, + { "ScaleAspectFill", ((int)Stretch.Fill).ToString() }, + }; + } + } + + public override IReadOnlyDictionary ExportedCustomDirectEventTypeConstants + { + get + { + var events = new Dictionary(); + var eventTypes = Enum.GetValues(typeof(ReactVideoEventType)).OfType(); + foreach (var eventType in eventTypes) + { + events.Add(eventType.GetEventName(), new Dictionary + { + { "registrationName", eventType.GetEventName() }, + }); + } + + return events; + } + } + + [ReactProp("src")] + public void SetSource(ReactVideoView view, JObject source) + { + view.Source = source.Value("uri"); + } + + [ReactProp("resizeMode")] + public void SetResizeMode(ReactVideoView view, string resizeMode) + { + view.Stretch = (Stretch)int.Parse(resizeMode); + } + + [ReactProp("repeat")] + public void SetRepeat(ReactVideoView view, bool repeat) + { + view.IsLoopingEnabled = repeat; + } + + [ReactProp("paused")] + public void SetPaused(ReactVideoView view, bool paused) + { + view.IsPaused = paused; + } + + [ReactProp("muted")] + public void SetMuted(ReactVideoView view, bool muted) + { + view.IsMuted = muted; + } + + [ReactProp("volume", DefaultDouble = 1.0)] + public void SetVolume(ReactVideoView view, double volume) + { + view.Volume = volume; + } + + [ReactProp("seek")] + public void SetSeek(ReactVideoView view, double? seek) + { + if (seek.HasValue) + { + view.Seek(seek.Value); + } + } + + [ReactProp("rate", DefaultDouble = 1.0)] + public void SetPlaybackRate(ReactVideoView view, double rate) + { + view.Rate = rate; + } + + [ReactProp("playInBackground")] + public void SetPlayInBackground(ReactVideoView view, bool playInBackground) + { + throw new NotImplementedException("Play in background has not been implemented on Windows."); + } + + [ReactProp("controls")] + public void SetControls(ReactVideoView view, bool controls) + { + view.IsUserControlEnabled = controls; + } + + [ReactProp("progressUpdateInterval")] + public void SetProgressUpdateInterval(ReactVideoView view, double progressUpdateInterval) + { + view.ProgressUpdateInterval = progressUpdateInterval; + } + + public override void OnDropViewInstance(ThemedReactContext reactContext, ReactVideoView view) + { + base.OnDropViewInstance(reactContext, view); + view.Dispose(); + } + + protected override ReactVideoView CreateViewInstance(ThemedReactContext reactContext) + { + return new ReactVideoView + { + HorizontalAlignment = HorizontalAlignment.Stretch, + }; + } + } +} diff --git a/windows/ReactNativeVideo/project.json b/windows/ReactNativeVideo/project.json new file mode 100644 index 00000000..21494af7 --- /dev/null +++ b/windows/ReactNativeVideo/project.json @@ -0,0 +1,17 @@ +{ + "dependencies": { + "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2", + "Newtonsoft.Json": "9.0.1" + }, + "frameworks": { + "uap10.0": {} + }, + "runtimes": { + "win10-arm": {}, + "win10-arm-aot": {}, + "win10-x86": {}, + "win10-x86-aot": {}, + "win10-x64": {}, + "win10-x64-aot": {} + } +} \ No newline at end of file From e32372f8a0c3f576a093cee6e181ea194b4e8b84 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Wed, 9 Nov 2016 16:05:45 -0800 Subject: [PATCH 2/8] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 4b718c34..dffa90df 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ Make the following additions to the given files manually: **windows/myapp.sln** Add the `ReactNativeVideo` project to your solution. + 1. Open the solution in Visual Studio 2015 2. Right-click Solution icon in Solution Explorer > Add > Existing Project... 3. Select `node_modules\react-native-video\windows\ReactNativeVideo\ReactNativeVideo.csproj` @@ -96,10 +97,12 @@ Add the `ReactNativeVideo` project to your solution. Add a reference to `ReactNativeVideo` to your main application project. Using Visual Studio 2015: + 1. Right-click main application project > Add > Reference... 2. Check `ReactNativeVideo` from Solution Projects. Manually from `windows/myapp/myapp.csproj`, add: + ```xml {e8f5f57f-757e-4237-ad23-f7a8755427cd} From be9f840537691bc5c35054b666cf754101a9dbda Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Thu, 10 Nov 2016 12:27:26 -0800 Subject: [PATCH 3/8] Update README.md --- README.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/README.md b/README.md index dffa90df..ef8102f9 100644 --- a/README.md +++ b/README.md @@ -94,22 +94,11 @@ Add the `ReactNativeVideo` project to your solution. **windows/myapp/myapp.csproj** -Add a reference to `ReactNativeVideo` to your main application project. - -Using Visual Studio 2015: +Add a reference to `ReactNativeVideo` to your main application project. From Visual Studio 2015: 1. Right-click main application project > Add > Reference... 2. Check `ReactNativeVideo` from Solution Projects. -Manually from `windows/myapp/myapp.csproj`, add: - -```xml - - {e8f5f57f-757e-4237-ad23-f7a8755427cd} - ReactNativeVideo - -``` - **MainPage.cs** Add the `ReactVideoPackage` class to your list of exported packages. From e0f968da294585ac4ccc8f11608c8db7f5ec235f Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Thu, 10 Nov 2016 12:28:48 -0800 Subject: [PATCH 4/8] Update ReactNativeVideo.csproj --- windows/ReactNativeVideo/ReactNativeVideo.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/ReactNativeVideo/ReactNativeVideo.csproj b/windows/ReactNativeVideo/ReactNativeVideo.csproj index 8ed6402e..479656aa 100644 --- a/windows/ReactNativeVideo/ReactNativeVideo.csproj +++ b/windows/ReactNativeVideo/ReactNativeVideo.csproj @@ -97,7 +97,7 @@ - + {c7673ad5-e3aa-468c-a5fd-fa38154e205c} ReactNative @@ -113,4 +113,4 @@ --> - \ No newline at end of file + From 5c3a5cb90d3167827c14edd1432624048294e7db Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Thu, 10 Nov 2016 12:29:54 -0800 Subject: [PATCH 5/8] Update ReactNativeVideo.csproj --- windows/ReactNativeVideo/ReactNativeVideo.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/ReactNativeVideo/ReactNativeVideo.csproj b/windows/ReactNativeVideo/ReactNativeVideo.csproj index 479656aa..d815960b 100644 --- a/windows/ReactNativeVideo/ReactNativeVideo.csproj +++ b/windows/ReactNativeVideo/ReactNativeVideo.csproj @@ -97,7 +97,7 @@ - + {c7673ad5-e3aa-468c-a5fd-fa38154e205c} ReactNative From 1ab222d251fc42c28054e377ea02e35596c84e5c Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Thu, 10 Nov 2016 13:09:13 -0800 Subject: [PATCH 6/8] Update ReactNativeVideo.csproj --- windows/ReactNativeVideo/ReactNativeVideo.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/ReactNativeVideo/ReactNativeVideo.csproj b/windows/ReactNativeVideo/ReactNativeVideo.csproj index d815960b..3fd0e59d 100644 --- a/windows/ReactNativeVideo/ReactNativeVideo.csproj +++ b/windows/ReactNativeVideo/ReactNativeVideo.csproj @@ -3,7 +3,7 @@ Debug - AnyCPU + x86 {E8F5F57F-757E-4237-AD23-F7A8755427CD} Library Properties From 5af9e2623304f48b0dc4178e6d81d0332fcf029b Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Thu, 10 Nov 2016 13:50:50 -0800 Subject: [PATCH 7/8] Update ReactVideoView.cs --- windows/ReactNativeVideo/ReactVideoView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/ReactNativeVideo/ReactVideoView.cs b/windows/ReactNativeVideo/ReactVideoView.cs index 2e02bf67..9c3d6c18 100644 --- a/windows/ReactNativeVideo/ReactVideoView.cs +++ b/windows/ReactNativeVideo/ReactVideoView.cs @@ -315,7 +315,7 @@ namespace ReactNativeVideo private static async void RunOnDispatcher(DispatchedHandler action) { - await CoreApplication.GetCurrentView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, action).AsTask().ConfigureAwait(false); + await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, action).AsTask().ConfigureAwait(false); } class ReactVideoEvent : Event From abefb3ae12ee53c27bea74dd6b241154304f0302 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Thu, 10 Nov 2016 15:04:01 -0800 Subject: [PATCH 8/8] Update ReactVideoView.cs --- windows/ReactNativeVideo/ReactVideoView.cs | 152 +++++++++++---------- 1 file changed, 81 insertions(+), 71 deletions(-) diff --git a/windows/ReactNativeVideo/ReactVideoView.cs b/windows/ReactNativeVideo/ReactVideoView.cs index 9c3d6c18..22063aff 100644 --- a/windows/ReactNativeVideo/ReactVideoView.cs +++ b/windows/ReactNativeVideo/ReactVideoView.cs @@ -17,9 +17,6 @@ namespace ReactNativeVideo private readonly DispatcherTimer _timer; - private bool _isSourceSet; - - private string _uri; private bool _isLoopingEnabled; private bool _isPaused; private bool _isMuted; @@ -39,9 +36,22 @@ namespace ReactNativeVideo { set { - _uri = value; - base.Source = MediaSource.CreateFromUri(new Uri(_uri)); - _isSourceSet = true; + var uri = value; + + base.Source = MediaSource.CreateFromUri(new Uri(uri)); + + this.GetReactContext() + .GetNativeModule() + .EventDispatcher + .DispatchEvent( + new ReactVideoEvent( + ReactVideoEventType.LoadStart.GetEventName(), + this.GetTag(), + new JObject + { + { "src", uri } + })); + ApplyModifiers(); SubscribeEvents(); } @@ -52,9 +62,10 @@ namespace ReactNativeVideo set { _isLoopingEnabled = value; - if (_isSourceSet) + var mediaPlayer = MediaPlayer; + if (mediaPlayer != null) { - MediaPlayer.IsLoopingEnabled = _isLoopingEnabled; + mediaPlayer.IsLoopingEnabled = _isLoopingEnabled; } } } @@ -64,9 +75,10 @@ namespace ReactNativeVideo set { _isMuted = value; - if (_isSourceSet) + var mediaPlayer = MediaPlayer; + if (mediaPlayer != null) { - MediaPlayer.IsMuted = _isMuted; + mediaPlayer.IsMuted = _isMuted; } } } @@ -76,15 +88,16 @@ namespace ReactNativeVideo set { _isPaused = value; - if (_isSourceSet) + var mediaPlayer = MediaPlayer; + if (mediaPlayer != null) { if (_isPaused) { - MediaPlayer.Pause(); + mediaPlayer.Pause(); } else { - MediaPlayer.Play(); + mediaPlayer.Play(); } } } @@ -95,9 +108,10 @@ namespace ReactNativeVideo set { _isUserControlEnabled = value; - if (_isSourceSet) + var mediaPlayer = MediaPlayer; + if (mediaPlayer != null) { - MediaPlayer.SystemMediaTransportControls.IsEnabled = _isUserControlEnabled; + mediaPlayer.SystemMediaTransportControls.IsEnabled = _isUserControlEnabled; } } } @@ -107,9 +121,10 @@ namespace ReactNativeVideo set { _volume = value; - if (_isSourceSet) + var mediaPlayer = MediaPlayer; + if (mediaPlayer != null) { - MediaPlayer.Volume = _volume; + mediaPlayer.Volume = _volume; } } } @@ -119,9 +134,10 @@ namespace ReactNativeVideo set { _rate = value; - if (_isSourceSet) + var mediaPlayer = MediaPlayer; + if (mediaPlayer != null) { - MediaPlayer.PlaybackSession.PlaybackRate = _rate; + mediaPlayer.PlaybackSession.PlaybackRate = _rate; } } } @@ -136,23 +152,24 @@ namespace ReactNativeVideo public void Seek(double seek) { - if (_isSourceSet) + var mediaPlayer = MediaPlayer; + if (mediaPlayer != null) { - MediaPlayer.PlaybackSession.Position = TimeSpan.FromSeconds(seek); + mediaPlayer.PlaybackSession.Position = TimeSpan.FromSeconds(seek); } } public void Dispose() { - if (_isSourceSet) + var mediaPlayer = MediaPlayer; + if (mediaPlayer != null) { _timer.Tick -= OnTick; - MediaPlayer.SourceChanged -= OnSourceChanged; - MediaPlayer.MediaOpened -= OnMediaOpened; - MediaPlayer.MediaFailed -= OnMediaFailed; - MediaPlayer.MediaEnded -= OnMediaEnded; - MediaPlayer.PlaybackSession.BufferingStarted -= OnBufferingStarted; - MediaPlayer.PlaybackSession.BufferingEnded -= OnBufferingEnded; + mediaPlayer.MediaOpened -= OnMediaOpened; + mediaPlayer.MediaFailed -= OnMediaFailed; + mediaPlayer.MediaEnded -= OnMediaEnded; + mediaPlayer.PlaybackSession.BufferingStarted -= OnBufferingStarted; + mediaPlayer.PlaybackSession.BufferingEnded -= OnBufferingEnded; MediaPlayer.PlaybackSession.SeekCompleted -= OnSeekCompleted; } @@ -172,55 +189,41 @@ namespace ReactNativeVideo private void SubscribeEvents() { _timer.Tick += OnTick; - MediaPlayer.SourceChanged += OnSourceChanged; - MediaPlayer.MediaOpened += OnMediaOpened; - MediaPlayer.MediaFailed += OnMediaFailed; - MediaPlayer.MediaEnded += OnMediaEnded; - MediaPlayer.PlaybackSession.BufferingStarted += OnBufferingStarted; - MediaPlayer.PlaybackSession.BufferingEnded += OnBufferingEnded; - MediaPlayer.PlaybackSession.SeekCompleted += OnSeekCompleted; + var mediaPlayer = MediaPlayer; + mediaPlayer.MediaOpened += OnMediaOpened; + mediaPlayer.MediaFailed += OnMediaFailed; + mediaPlayer.MediaEnded += OnMediaEnded; + mediaPlayer.PlaybackSession.BufferingStarted += OnBufferingStarted; + mediaPlayer.PlaybackSession.BufferingEnded += OnBufferingEnded; + mediaPlayer.PlaybackSession.SeekCompleted += OnSeekCompleted; } private void OnTick(object sender, object e) { - if (_isSourceSet && !_isCompleted && !_isPaused) + var mediaPlayer = MediaPlayer; + if (mediaPlayer != null && !_isCompleted && !_isPaused) { this.GetReactContext() .GetNativeModule() .EventDispatcher .DispatchEvent( new ReactVideoEvent( - ReactVideoEventType.Progress.GetEventName(), + ReactVideoEventType.Progress.GetEventName(), this.GetTag(), new JObject { - { "currentTime", MediaPlayer.PlaybackSession.Position.TotalSeconds }, + { "currentTime", mediaPlayer.PlaybackSession.Position.TotalSeconds }, { "playableDuration", 0.0 /* TODO */ } })); } } - private void OnSourceChanged(MediaPlayer sender, object args) - { - this.GetReactContext() - .GetNativeModule() - .EventDispatcher - .DispatchEvent( - new ReactVideoEvent( - ReactVideoEventType.LoadStart.GetEventName(), - this.GetTag(), - new JObject - { - { "src", this._uri } - })); - } - private void OnMediaOpened(MediaPlayer sender, object args) { RunOnDispatcher(delegate { - var width = MediaPlayer.PlaybackSession.NaturalVideoWidth; - var height = MediaPlayer.PlaybackSession.NaturalVideoHeight; + var width = sender.PlaybackSession.NaturalVideoWidth; + var height = sender.PlaybackSession.NaturalVideoHeight; var orientation = (width > height) ? "landscape" : "portrait"; var size = new JObject { @@ -229,18 +232,25 @@ namespace ReactNativeVideo { "orientation", orientation } }; - this.GetReactContext().GetNativeModule().EventDispatcher.DispatchEvent(new ReactVideoView.ReactVideoEvent(ReactVideoEventType.Load.GetEventName(), this.GetTag(), new JObject - { - { "duration", MediaPlayer.PlaybackSession.NaturalDuration.TotalSeconds }, - { "currentTime", MediaPlayer.PlaybackSession.Position.TotalSeconds }, - { "naturalSize", size }, - { "canPlayFastForward", false }, - { "canPlaySlowForward", false }, - { "canPlaySlow", false }, - { "canPlayReverse", false }, - { "canStepBackward", false }, - { "canStepForward", false } - })); + this.GetReactContext() + .GetNativeModule() + .EventDispatcher + .DispatchEvent( + new ReactVideoEvent( + ReactVideoEventType.Load.GetEventName(), + this.GetTag(), + new JObject + { + { "duration", sender.PlaybackSession.NaturalDuration.TotalSeconds }, + { "currentTime", sender.PlaybackSession.Position.TotalSeconds }, + { "naturalSize", size }, + { "canPlayFastForward", false }, + { "canPlaySlowForward", false }, + { "canPlaySlow", false }, + { "canPlayReverse", false }, + { "canStepBackward", false }, + { "canStepForward", false } + })); }); } @@ -258,7 +268,7 @@ namespace ReactNativeVideo .DispatchEvent( new ReactVideoEvent( ReactVideoEventType.Error.GetEventName(), - this.GetTag(), + this.GetTag(), new JObject { { "error", errorData } @@ -273,7 +283,7 @@ namespace ReactNativeVideo .EventDispatcher .DispatchEvent( new ReactVideoEvent( - ReactVideoEventType.End.GetEventName(), + ReactVideoEventType.End.GetEventName(), this.GetTag(), null)); } @@ -308,7 +318,7 @@ namespace ReactNativeVideo .GetNativeModule() .EventDispatcher.DispatchEvent( new ReactVideoEvent( - ReactVideoEventType.Seek.GetEventName(), + ReactVideoEventType.Seek.GetEventName(), this.GetTag(), new JObject())); } @@ -323,7 +333,7 @@ namespace ReactNativeVideo private readonly string _eventName; private readonly JObject _eventData; - public ReactVideoEvent(string eventName, int viewTag, JObject eventData) + public ReactVideoEvent(string eventName, int viewTag, JObject eventData) : base(viewTag, TimeSpan.FromTicks(Environment.TickCount)) { _eventName = eventName;