| | 1 | | using System; |
| | 2 | | using System.Runtime.InteropServices; |
| | 3 | |
|
| | 4 | | namespace DCL.Components.Video.Plugin |
| | 5 | | { |
| | 6 | | public static class WebGLVideoPlugin |
| | 7 | | { |
| | 8 | | #if UNITY_WEBGL && !UNITY_EDITOR |
| | 9 | | [DllImport("__Internal")] |
| | 10 | | public static extern void WebVideoPlayerCreate(string id, string url, bool useHls); |
| | 11 | | [DllImport("__Internal")] |
| | 12 | | public static extern void WebVideoPlayerRemove(string id); |
| | 13 | | [DllImport("__Internal")] |
| | 14 | | public static extern void WebVideoPlayerTextureUpdate(string id); |
| | 15 | | [DllImport("__Internal")] |
| | 16 | | public static extern int WebVideoPlayerTextureGet(string id); |
| | 17 | | [DllImport("__Internal")] |
| | 18 | | public static extern void WebVideoPlayerPlay(string id, float startTime); |
| | 19 | | [DllImport("__Internal")] |
| | 20 | | public static extern void WebVideoPlayerPause(string id); |
| | 21 | | [DllImport("__Internal")] |
| | 22 | | public static extern void WebVideoPlayerVolume(string id, float volume); |
| | 23 | | [DllImport("__Internal")] |
| | 24 | | public static extern int WebVideoPlayerGetHeight(string id); |
| | 25 | | [DllImport("__Internal")] |
| | 26 | | public static extern int WebVideoPlayerGetWidth(string id); |
| | 27 | | [DllImport("__Internal")] |
| | 28 | | public static extern float WebVideoPlayerGetTime(string id); |
| | 29 | | [DllImport("__Internal")] |
| | 30 | | public static extern float WebVideoPlayerGetDuration(string id); |
| | 31 | | [DllImport("__Internal")] |
| | 32 | | public static extern int WebVideoPlayerGetState(string id); |
| | 33 | | [DllImport("__Internal")] |
| | 34 | | public static extern string WebVideoPlayerGetError(string id); |
| | 35 | | [DllImport("__Internal")] |
| | 36 | | public static extern void WebVideoPlayerSetTime(string id, float second); |
| | 37 | | [DllImport("__Internal")] |
| | 38 | | public static extern void WebVideoPlayerSetPlaybackRate(string id, float playbackRate); |
| | 39 | | [DllImport("__Internal")] |
| | 40 | | public static extern void WebVideoPlayerSetLoop(string id, bool loop); |
| | 41 | | #else |
| 0 | 42 | | public static void WebVideoPlayerCreate(string id, string url, bool useHls) { } |
| 0 | 43 | | public static void WebVideoPlayerRemove(string id) { } |
| 0 | 44 | | public static void WebVideoPlayerTextureUpdate(string id) { } |
| 0 | 45 | | public static int WebVideoPlayerTextureGet(string id) { return -1; } |
| 0 | 46 | | public static void WebVideoPlayerPlay(string id, float startTime) { } |
| 0 | 47 | | public static void WebVideoPlayerPause(string id) { } |
| 0 | 48 | | public static void WebVideoPlayerVolume(string id, float volume) { } |
| 0 | 49 | | public static int WebVideoPlayerGetHeight(string id) { return 0; } |
| 0 | 50 | | public static int WebVideoPlayerGetWidth(string id) { return 0; } |
| 0 | 51 | | public static float WebVideoPlayerGetTime(string id) { return 0; } |
| 0 | 52 | | public static float WebVideoPlayerGetDuration(string id) { return 0; } |
| 0 | 53 | | public static int WebVideoPlayerGetState(string id) { return (int)VideoState.ERROR; } |
| 0 | 54 | | public static string WebVideoPlayerGetError(string id) { return "WebVideoPlayer: Platform not supported"; } |
| 0 | 55 | | public static void WebVideoPlayerSetTime(string id, float second) { } |
| 0 | 56 | | public static void WebVideoPlayerSetPlaybackRate(string id, float playbackRate) { } |
| 0 | 57 | | public static void WebVideoPlayerSetLoop(string id, bool loop) { } |
| | 58 | | #endif |
| | 59 | | } |
| | 60 | | } |