Classes | Functions | Attributes | Properties | List of all members
Headjack.VideoPlayer Class Reference
Inheritance diagram for Headjack.VideoPlayer:

Classes

struct  AudioConfig
 Description of which audio tracks are playing, audio track in video file (internal) and/or external spatial audio file. Get the current audio configuration using GetAudioConfig, set the audio configuration using SetAudioConfig(bool, bool). More...
 

Functions

AudioConfig GetAudioConfig ()
 Gets the audio playing configuration, whether playing audio of video file (internal) and/or playing external (spatial) audio file (external) More...
 
virtual void Pause ()
 Pause the video More...
 
virtual void PauseResume ()
 Switch between playing and paused More...
 
virtual void Play (string FullPath, OnEnd onEnd=null)
 Play a new video More...
 
virtual void Resume ()
 Resume the video More...
 
virtual void SetAudioConfig (bool internalAudio, bool externalAudio)
 Sets audio configuration, whether to play audio of video file and whether to play external (spatial) audio file More...
 
void SetEyes (bool InputIsStereo, bool OutputIsStereo)
 Stereoscopic settings More...
 
void SetStereoscopicRendering (bool Stereoscopic)
 Stereoscopic video rendering More...
 
virtual void Stop ()
 Stop the video More...
 
virtual void Update ()
 

Attributes

bool Loop
 If this is a looping video More...
 

Properties

bool Buffering [get]
 True if the videoplayer is buffering More...
 
long Duration [get]
 The total duration of the video More...
 
bool IsPlaying [get]
 If the video is being played right now More...
 
bool Mute [get, set]
 If this video is muted More...
 
float Seek [get, set]
 The video position (0.0 - 1.0) More...
 
long SeekMs [get, set]
 The video position in milliseconds More...
 
float Volume [get, set]
 Videoplayer volume More...
 

Member Function Documentation

§ GetAudioConfig()

AudioConfig Headjack.VideoPlayer.GetAudioConfig ( )
inline

Gets the audio playing configuration, whether playing audio of video file (internal) and/or playing external (spatial) audio file (external)

Returns
AudioConfig struct describing current audio configuration
Note
use SetAudioConfig(bool, bool) to change the audio configuration

§ Pause()

virtual void Headjack.VideoPlayer.Pause ( )
inlinevirtual

Pause the video

Note
Will set VideoPlayer.IsPlaying to false

Example

void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
App.Player.Pause();
}
}

§ PauseResume()

virtual void Headjack.VideoPlayer.PauseResume ( )
inlinevirtual

Switch between playing and paused

Example

void Update()
{
//Pause switch
if (Input.GetKeyDown(KeyCode.Space))
{
App.Player.PauseResume();
}
}

§ Play()

virtual void Headjack.VideoPlayer.Play ( string  FullPath,
OnEnd  onEnd = null 
)
inlinevirtual

Play a new video

Parameters
FullPathFull path to the mp4 file
onEndWill be called when the video is finished
Note
onEnd overwrites current onEnd
Warning
You need a full path to the mp4 file. To play videos from the server use App.Play

§ Resume()

virtual void Headjack.VideoPlayer.Resume ( )
inlinevirtual

Resume the video

Note
Will set VideoPlayer.IsPlaying to true

Example

void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
App.Player.Resume();
}
}

§ SetAudioConfig()

virtual void Headjack.VideoPlayer.SetAudioConfig ( bool  internalAudio,
bool  externalAudio 
)
inlinevirtual

Sets audio configuration, whether to play audio of video file and whether to play external (spatial) audio file

Parameters
internalAudioset to true to enable video audio track
externalAudioset to true to enable external (spatial) audio track
Note
enabling both internal and external audio causes both tracks to play simultaneously
enabling the external audio track without an external audio file being present in the project has no effect

§ SetEyes()

void Headjack.VideoPlayer.SetEyes ( bool  InputIsStereo,
bool  OutputIsStereo 
)
inline

Stereoscopic settings

Parameters
InputIsStereoIs the video stereoscopic
OutputIsStereoDisplay in stereoscopic
Warning
This will be automatically set with App.Play. Use VideoPlayer.SetStereoscopicRendering(bool) to switch enable/disable the stereoscopic rendering

§ SetStereoscopicRendering()

void Headjack.VideoPlayer.SetStereoscopicRendering ( bool  Stereoscopic)
inline

Stereoscopic video rendering

Parameters
StereoscopicRender stereoscopic
Note
You can use this to disable the stereo effect if you want to display an interface

Example

public void SwitchToMono()
{
App.Player.SetStereoscopicRendering(false);
}

§ Stop()

virtual void Headjack.VideoPlayer.Stop ( )
inlinevirtual

Stop the video

Example

public void StopVideo()
{
App.Player.Stop();
}

Member Data Documentation

§ Loop

bool Headjack.VideoPlayer.Loop

If this is a looping video

Returns
If the video is currently set to loop

Example

public void LoopButtonSwitch()https://drive.google.com/file/d/0B7-v0gGHpVDeSHZwVFQwbjVCbjQ/view?usp=sharing
{
App.Player.Loop=!App.Player.Loop;
}

Property Documentation

§ Buffering

bool Headjack.VideoPlayer.Buffering
get

True if the videoplayer is buffering

Returns
If the videoplayer is buffering

Example

//Show buffering icon when buffering
void Update()
{
if(App.Player.Buffering)
{
BufferingObject.SetActive(true);
}else{
BufferingObject.SetActive(false);
}
}

§ Duration

long Headjack.VideoPlayer.Duration
get

The total duration of the video

Returns
The total duration of the video in milliseconds

Example

public float VideoLengthInSeconds()
{
return App.Player.Duration*0.001f;
}

§ IsPlaying

bool Headjack.VideoPlayer.IsPlaying
get

If the video is being played right now

Returns
True if the video is being played right now
Note
False on pause

Example

void Update()
{
//Don't show the crosshair if the video is playing
if(App.Player.IsPlaying)
{
App.ShowCrosshair=false;
}
}

§ Mute

bool Headjack.VideoPlayer.Mute
getset

If this video is muted

Returns
If the video is currently muted

Example

public void MuteButtonSwitch()
{
App.Player.Mute=!App.Player.Mute;
}

§ Seek

float Headjack.VideoPlayer.Seek
getset

The video position (0.0 - 1.0)

Returns
The current position of the video from 0.0 to 1.0

Example

//Change position with Arrow Keys
void Update()
{
if (Input.GetKeyDown(KeyCode.RightArrow))
{
App.Player.Seek += 0.05f;
}
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
App.Player.Seek -= 0.05f;
}
}

§ SeekMs

long Headjack.VideoPlayer.SeekMs
getset

The video position in milliseconds

Returns
The current position of the video in milliseconds

Example

//Change position by 5 seconds with Arrow Keys
void Update()
{
if (Input.GetKeyDown(KeyCode.RightArrow))
{
App.Player.SeekMs += 5000;
}
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
App.Player.SeekMs -= 5000;
}
}

§ Volume

float Headjack.VideoPlayer.Volume
getset

Videoplayer volume

Returns
The current volume of the videoplayer

Example

//Change volume with Arrow Keys
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
App.Player.Volume += 0.1f;
}
if (Input.GetKeyDown(KeyCode.DownArrow))
{
App.Player.Volume -= 0.1f;
}
}

The documentation for this class was generated from the following file: