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
Where the passed parameter is the URL or path of the videoPlay() : bool
Which plays (or resumes) the video playback and returns a boolean based on whether the command was successfulPause() : bool
Pauses the video and returns if the command was successfulStop() : bool
Stops the video playback and returns if the command was successfulGetPlaybackRate() : double
Returns the rate at which the video is being playedGetDuration() : long
Returns the length of the video in 1/10^7 secondsSeekByRatio(float ratio) : bool
Sets the position of the video player atratio
completion stage and returns if the attempt was successfulSeekByTime(long position) : bool
Sets the position of the video player atposition
time.position
is in1/10^7
second units
MediaTexture
Returns theTexture2D
object that is updated by the plugin with video framesMediaDescription
Returns some information of the video being played. These include the video width, height, duration and whether it can be seeked on.
OnLoaded
When the player is done loading a video successfullyOnFailed
When he player fails to load a videoOnPlay
When the player starts the playback of the videoOnPaused
When the playback is pausedOnStopped
When the playback is stoppedOnEnded
Whent he video playback is completed
GPUVideoPlayer
was tested with an 800mb8192x4096
30FPS H265 MP4 video file. Loading took 195 ms. Video playback was at 30FPS with Unity's framerate at 60.
- A simple video player app with load, pause, stop, 5sec FWD, 5sec BWD is available inside the Demo folder
- Currently runs only on Microsoft Windows. Tested on 64 bit OS.
- May require HEVC Video Extensions based on your usage.