Thanks to xue-fei for identifying the original authors of the CPP code. Please refer to MediaPlayback for a more suitable solution.
This repository is not being actively maintained. Issues may not be addressed.
Alternative to Unity's VideoPlayer
component. Run HEVC/H265 videos with GPU decoding, lower loading times and better performance.
The GPUVideoPlayer
class derives from MonoBehaviour
and needs to be on the scene. GPUVideoPlayer
component also provides some primitive auto play features.
Load(string) : void
Play() : bool
Pause() : bool
Stop() : bool
GetPlaybackRate() : double
GetDuration() : long
SeekByRatio(float ratio) : bool
ratio
completion stage and returns if the attempt was successful SeekByTime(long position) : bool
position
time. position
is in 1/10^7
second unitsMediaTexture
Texture2D
object that is updated by the plugin with video frames MediaDescription
The states of a GPUVideoPlayer
instance is represented using an enum called `GPUVideoPlayer.State' and has the following values:
The current state can be obtained using GPUVideoPlayer.MediaState
which derives from UnityEvent<GPUVideoPlayer.State>
GPUVideoPlayer
was tested with an 800mb 8192x4096
30FPS H265 MP4 video file. Loading took 195 ms. Video playback was at 30FPS with Unity's framerate at 60.