< Summary

Class:VideoPluginWrapper_Native
Assembly:VideoComponents
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Desktop/Scripts/MainScripts/DCL/Components/Video/VideoPluginWrapper_Native.cs
Covered lines:0
Uncovered lines:37
Coverable lines:37
Total lines:114
Line coverage:0% (0 of 37)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:18
Method coverage:0% (0 of 18)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
VideoPluginWrapper_Native()0%2100%
Create(...)0%2100%
Create(...)0%2100%
Remove(...)0%2100%
TextureUpdate(...)0%2100%
PrepareTexture(...)0%2100%
Play(...)0%6200%
Pause(...)0%2100%
SetVolume(...)0%2100%
GetHeight(...)0%2100%
GetWidth(...)0%2100%
GetTime(...)0%2100%
GetDuration(...)0%2100%
GetState(...)0%56700%
GetError(...)0%2100%
SetTime(...)0%2100%
SetPlaybackRate(...)0%2100%
SetLoop(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Desktop/Scripts/MainScripts/DCL/Components/Video/VideoPluginWrapper_Native.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using DCL.Components.Video.Plugin;
 4using UnityEngine;
 5
 6public class VideoPluginWrapper_Native : IVideoPluginWrapper
 7{
 08    private Dictionary<string, DCLVideoPlayer> videoPlayers = new Dictionary<string, DCLVideoPlayer>();
 9
 10    public void Create(string id, string url, bool useHls)
 11    {
 012        videoPlayers.Add(id, new DCLVideoPlayer(url));
 013    }
 14
 15    public void Create(string id, string url, VideoType videoType)
 16    {
 017        Create(id, url, videoType == VideoType.Hls);
 018    }
 19
 20    public void Remove(string id)
 21    {
 022        videoPlayers[id].Dispose();
 023        videoPlayers.Remove(id);
 024    }
 25
 26    public void TextureUpdate(string id)
 27    {
 028        videoPlayers[id].UpdateVideoTexture();
 029    }
 30
 31    public Texture2D PrepareTexture(string id)
 32    {
 033        videoPlayers[id].PrepareTexture();
 034        return videoPlayers[id].GetTexture();
 35    }
 36
 37    public void Play(string id, float startTime)
 38    {
 039        videoPlayers[id].Play();
 40
 041        if (startTime > 0) { videoPlayers[id].SetSeekTime(startTime); }
 042    }
 43
 44    public void Pause(string id)
 45    {
 046        videoPlayers[id].Pause();
 047    }
 48
 49    public void SetVolume(string id, float volume)
 50    {
 051        videoPlayers[id].SetVolume(volume);
 052    }
 53
 54    public int GetHeight(string id)
 55    {
 056        return videoPlayers[id].GetVideoHeight();
 57    }
 58
 59    public int GetWidth(string id)
 60    {
 061        return videoPlayers[id].GetVideoWidth();
 62    }
 63
 64    public float GetTime(string id)
 65    {
 066        return videoPlayers[id].GetPlaybackPosition();
 67    }
 68
 69    public float GetDuration(string id)
 70    {
 071        return videoPlayers[id].GetDuration();
 72    }
 73
 74    public VideoState GetState(string id)
 75    {
 076        DCLVideoPlayer videoPlayer = videoPlayers[id];
 77
 078        switch (videoPlayer.GetState())
 79        {
 80            case DCLVideoPlayer.VideoPlayerState.Loading:
 081                return VideoState.LOADING;
 82            case DCLVideoPlayer.VideoPlayerState.Error:
 083                return VideoState.ERROR;
 84            case DCLVideoPlayer.VideoPlayerState.Ready:
 085                if (videoPlayer.GetTexture() == null) { return VideoState.READY; }
 86
 87                break;
 88        }
 89
 090        if (videoPlayer.IsBuffering()) { return VideoState.BUFFERING; }
 91
 092        return videoPlayer.IsPlaying() ? VideoState.PLAYING : VideoState.PAUSED;
 93    }
 94
 95    public string GetError(string id)
 96    {
 097        return "";
 98    }
 99
 100    public void SetTime(string id, float second)
 101    {
 0102        videoPlayers[id].SetSeekTime(second);
 0103    }
 104
 105    public void SetPlaybackRate(string id, float playbackRate)
 106    {
 0107        videoPlayers[id].SetPlaybackRate(playbackRate);
 0108    }
 109
 110    public void SetLoop(string id, bool loop)
 111    {
 0112        videoPlayers[id].SetLoop(loop);
 0113    }
 114}