Direct Video Android for Unity
Direct Video Unity docs
Loading...
Searching...
No Matches
DirectVideoAndroid.DirectVideoPlayer Class Reference

Public Types

enum  RenderMode { DirectVideo , UnityVideoPlayer , DebugTexture , DoNothing }
 Render modes for the video player. More...
enum  State {
  Closed , RequestingPermissions , PermissionDenied , OpenFailed ,
  Paused , Playing , PlayingSuspended
}
 A video player state. More...
enum  LogFlags {
  Error = 1 << 0 , TextureImplementation = 1 << 1 , TextureImplementation_Verbose = 1 << 2 , Decoding = 1 << 3 ,
  Decoding_Verbose = 1 << 4 , Vulkan = 1 << 5 , Vulkan_Verbose = 1 << 6 , Unity_Plugin = 1 << 7 ,
  Unity_Plugin_Verbose = 1 << 8
}

Public Member Functions

void Prepare ()
 Prepare video for playing. This is a no-op provided so old VideoPlayer code works.
State GetState ()
 Get the current player state.
RenderMode GetCurrentRenderMode ()
 Get the currently active render mode.
void Play ()
 Play the video.
void Stop ()
 Stop playing the video.
void TogglePlay ()
 Toggle play/pause state.
State Open (string name, bool autoplay=false, bool requestPermissionsIfNeeded=true)
 Open a file for playback.
bool Close ()
 Close the current video file.
void ToggleUnityPlayer ()
 Switch between DirectVideo and the Unity VideoPlayer, mainly useful for debugging purposes.

Public Attributes

AudioSource audioSource
 Audio source used for audio output.
string sourcePath =""
 Path to video file to open on creation.
bool playOnAwake = true
 Auto-play the video source on opening.
bool loop = true
 Loop the video when it reaches the end.
RenderMode modeOnNonAndroidPlatforms = RenderMode.UnityVideoPlayer
 Render mode to use on non-Android platforms and editor.
RenderTexture targetTexture
 Texture to output video to.
string fallbackFilenamePattern = "{FILE}-fallback-{N}.{EXT}"
 Pattern used for fallback filenames.
LogFlags internalLoggingFlags = 0

Properties

string actualPlayingURL [get]
 real URL being played (after fallbacks if applicable)
int audioChannels [get]
 Number of audio channels in the current video.
int audioRate [get]
 Audio sampling rate.
bool seeking [get]
 Is the player currently seeking?
double time [get, set]
 Get or set the current playback time in seconds.
double length [get]
 The duration of the video in seconds.
int width [get]
 Width of the video frames in pixels.
int height [get]
 Height of the video frames in pixels.
bool isPlaying [get]
 Is the video currently playing?
string url [get, set]
 The current url as a property - if you set it it will close any current url (and play if playOnAwake is set)

Member Enumeration Documentation

◆ LogFlags

<summary Bitfield flags for showing logs from DirectVideo native code These logs go into Android logcat.

Enumerator
Error 

Errors.

TextureImplementation 

Show status of texture drawing.

TextureImplementation_Verbose 

Show lots of stuff about texture drawing.

Decoding 

Show decoder progress and info.

Decoding_Verbose 

More stuff about decoding.

Vulkan 

Things about vulkan API use.

Vulkan_Verbose 

More stuff about vulkan API use.

Unity_Plugin 
Unity_Plugin_Verbose 

◆ RenderMode

Render modes for the video player.

Enumerator
DirectVideo 

DirectVideo rendering (the default on Android)

UnityVideoPlayer 

Play with Unity VideoPlayer class.

DebugTexture 

Show a debug texture.

DoNothing 

Don't do anything.

◆ State

A video player state.

Enumerator
Closed 

Player is closed.

RequestingPermissions 

Player is requesting permission to access a file.

PermissionDenied 

Player couldn't get permissions to access the current file.

OpenFailed 

Opening the current file failed.

Paused 

The file is open but paused.

Playing 

The file is open and playing.

PlayingSuspended 

playing is suspended because Unity has been paused or sent to the background.

Member Function Documentation

◆ Close()

bool DirectVideoAndroid.DirectVideoPlayer.Close ( )
inline

Close the current video file.

Returns
True on success

◆ GetCurrentRenderMode()

RenderMode DirectVideoAndroid.DirectVideoPlayer.GetCurrentRenderMode ( )
inline

Get the currently active render mode.

◆ GetState()

State DirectVideoAndroid.DirectVideoPlayer.GetState ( )
inline

Get the current player state.

Returns
The player state.

◆ Open()

State DirectVideoAndroid.DirectVideoPlayer.Open ( string name,
bool autoplay = false,
bool requestPermissionsIfNeeded = true )
inline

Open a file for playback.

Parameters
nameThe path to the file to be opened. If this starts with ./ it refers to a path in StreamingAssets
autoplayStart playing as soon as loaded.
requestPermissionsIfNeededAsk for Android permissions if they are required (e.g. for external files).
Returns
State of the player after the open call.

◆ Play()

void DirectVideoAndroid.DirectVideoPlayer.Play ( )
inline

Play the video.

◆ Prepare()

void DirectVideoAndroid.DirectVideoPlayer.Prepare ( )
inline

Prepare video for playing. This is a no-op provided so old VideoPlayer code works.

◆ Stop()

void DirectVideoAndroid.DirectVideoPlayer.Stop ( )
inline

Stop playing the video.

◆ TogglePlay()

void DirectVideoAndroid.DirectVideoPlayer.TogglePlay ( )
inline

Toggle play/pause state.

◆ ToggleUnityPlayer()

void DirectVideoAndroid.DirectVideoPlayer.ToggleUnityPlayer ( )
inline

Switch between DirectVideo and the Unity VideoPlayer, mainly useful for debugging purposes.

Member Data Documentation

◆ audioSource

AudioSource DirectVideoAndroid.DirectVideoPlayer.audioSource

Audio source used for audio output.

◆ fallbackFilenamePattern

string DirectVideoAndroid.DirectVideoPlayer.fallbackFilenamePattern = "{FILE}-fallback-{N}.{EXT}"

Pattern used for fallback filenames.

If a video is too large or too high FPS for the target device, it will fallback to videos named based on this pattern: The default is: "{FILE}-fallback-{N}.{EXT}"

In pattern, the following tokens are replaced: {FILE} is replaced with base name of the original file, {N} is replaced with a fallback index (starting at 1) {EXT} with the file extension.")]

◆ internalLoggingFlags

LogFlags DirectVideoAndroid.DirectVideoPlayer.internalLoggingFlags = 0

Internal logging flags for native DirectVideo code

  • this is usually only really useful for debugging issues with the developer.

◆ loop

bool DirectVideoAndroid.DirectVideoPlayer.loop = true

Loop the video when it reaches the end.

◆ modeOnNonAndroidPlatforms

RenderMode DirectVideoAndroid.DirectVideoPlayer.modeOnNonAndroidPlatforms = RenderMode.UnityVideoPlayer

Render mode to use on non-Android platforms and editor.

◆ playOnAwake

bool DirectVideoAndroid.DirectVideoPlayer.playOnAwake = true

Auto-play the video source on opening.

◆ sourcePath

string DirectVideoAndroid.DirectVideoPlayer.sourcePath =""

Path to video file to open on creation.

◆ targetTexture

RenderTexture DirectVideoAndroid.DirectVideoPlayer.targetTexture

Texture to output video to.

Property Documentation

◆ actualPlayingURL

string DirectVideoAndroid.DirectVideoPlayer.actualPlayingURL
get

real URL being played (after fallbacks if applicable)

◆ audioChannels

int DirectVideoAndroid.DirectVideoPlayer.audioChannels
get

Number of audio channels in the current video.

◆ audioRate

int DirectVideoAndroid.DirectVideoPlayer.audioRate
get

Audio sampling rate.

◆ height

int DirectVideoAndroid.DirectVideoPlayer.height
get

Height of the video frames in pixels.

◆ isPlaying

bool DirectVideoAndroid.DirectVideoPlayer.isPlaying
get

Is the video currently playing?

◆ length

double DirectVideoAndroid.DirectVideoPlayer.length
get

The duration of the video in seconds.

◆ seeking

bool DirectVideoAndroid.DirectVideoPlayer.seeking
get

Is the player currently seeking?

◆ time

double DirectVideoAndroid.DirectVideoPlayer.time
getset

Get or set the current playback time in seconds.

◆ url

string DirectVideoAndroid.DirectVideoPlayer.url
getset

The current url as a property - if you set it it will close any current url (and play if playOnAwake is set)

◆ width

int DirectVideoAndroid.DirectVideoPlayer.width
get

Width of the video frames in pixels.


The documentation for this class was generated from the following file:
  • Packages/com.joemarshall-e34fba28-d4ce-4388-956f-c5d4264e5b78.directvideoandroid/Runtime/DirectVideoPlayer.cs