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
This commit is contained in:
36
windows/ReactNativeVideo/ReactVideoEventTypeExtensions.cs
Normal file
36
windows/ReactNativeVideo/ReactVideoEventTypeExtensions.cs
Normal file
@@ -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}'."));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user