| | 1 | | using System; |
| | 2 | | using System.Runtime.InteropServices; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace DCL.Components.Video.Plugin |
| | 6 | | { |
| | 7 | | public class VideoPluginWrapper_WebGL : IVideoPluginWrapper |
| | 8 | | { |
| 0 | 9 | | public void Create(string id, string url, bool useHls) { WebGLVideoPlugin.WebVideoPlayerCreate(id, url, useHls); |
| 0 | 10 | | public void Remove(string id) { WebGLVideoPlugin.WebVideoPlayerRemove(id); } |
| 0 | 11 | | public void TextureUpdate(string id) { WebGLVideoPlugin.WebVideoPlayerTextureUpdate(id); } |
| | 12 | |
|
| | 13 | | public Texture2D PrepareTexture(string id) |
| | 14 | | { |
| 0 | 15 | | Texture2D texture = new Texture2D(1, 1); |
| 0 | 16 | | texture.UpdateExternalTexture((IntPtr)WebGLVideoPlugin.WebVideoPlayerTextureGet(id)); |
| 0 | 17 | | texture.Apply(); |
| 0 | 18 | | return texture; |
| | 19 | | } |
| | 20 | |
|
| 0 | 21 | | public void Play(string id, float startTime) { WebGLVideoPlugin.WebVideoPlayerPlay(id, startTime); } |
| 0 | 22 | | public void Pause(string id) { WebGLVideoPlugin.WebVideoPlayerPause(id); } |
| 0 | 23 | | public void SetVolume(string id, float volume) { WebGLVideoPlugin.WebVideoPlayerVolume(id, volume); } |
| 0 | 24 | | public int GetHeight(string id) { return WebGLVideoPlugin.WebVideoPlayerGetHeight(id); } |
| 0 | 25 | | public int GetWidth(string id) { return WebGLVideoPlugin.WebVideoPlayerGetWidth(id); } |
| 0 | 26 | | public float GetTime(string id) { return WebGLVideoPlugin.WebVideoPlayerGetTime(id); } |
| 0 | 27 | | public float GetDuration(string id) { return WebGLVideoPlugin.WebVideoPlayerGetDuration(id); } |
| 0 | 28 | | public VideoState GetState(string id) { return (VideoState)WebGLVideoPlugin.WebVideoPlayerGetState(id); } |
| 0 | 29 | | public string GetError(string id) { return WebGLVideoPlugin.WebVideoPlayerGetError(id); } |
| 0 | 30 | | public void SetTime(string id, float second) { WebGLVideoPlugin.WebVideoPlayerSetTime(id, second); } |
| 0 | 31 | | public void SetPlaybackRate(string id, float playbackRate) { WebGLVideoPlugin.WebVideoPlayerSetPlaybackRate(id, |
| 0 | 32 | | public void SetLoop(string id, bool loop) { WebGLVideoPlugin.WebVideoPlayerSetLoop(id, loop); } |
| | 33 | | } |
| | 34 | | } |