You.i Engine
CYIVideoPlayerStateManager Class Reference

Detailed Description

A class which manages the various media and playback states of the CYIAbstractVideoPlayer.

This class is responsible for managing the current state of the CYIAbstractVideoPlayer. Implementers of concrete CYIAbstractVideoPlayer classes must notify the CYIVideoPlayerStateManager of state transitions when they occur in the concrete player. It is expected that these transitions will be made in response to notifications from the underlying player. These state transitions follow a strict ordering. Failure to follow the specified state ordering will result in an assertion in a debug build and the CYIAbstractVideoPlayer being sent into an error state in a release build.

The CYIVideoPlayerStateManager maintains six states which are separated into two categories, CYIAbstractVideoPlayer::MediaState and CYIAbstractVideoPlayer::PlaybackState. The state diagram is displayed below:

video-player-states.png

The CYIAbstractVideoPlayer::MediaState represents the state of the video media loaded in the player. There are three states in CYIAbstractVideoPlayer::MediaState. These are:

The CYIAbstractVideoPlayer::PlaybackState represents the state of media playback in the player. There are three states in the CYIAbstractVideoPlayer::PlaybackState. These are:

Note
Implementers of concrete video players must signal TransitionToMediaPreparing, TransitionToMediaReady, TransitionToPlaybackPlaying, TransitionToPlaybackPaused and TransitionToPlaybackBuffering following the state ordering described above. TransitionToMediaUnloaded is signalled by the CYIAbstractVideoPlayer in the case of error and CYIAbstractVideoPlayer::Stop() and is not required to be signalled by a concrete player.

#include <player/YiVideoPlayerStateManager.h>

Inheritance diagram for CYIVideoPlayerStateManager:

Public Member Functions

 CYIVideoPlayerStateManager (CYIAbstractVideoPlayer *pPlayer)
 
virtual ~CYIVideoPlayerStateManager ()
 
void TransitionToMediaUnloaded ()
 
void TransitionToMediaPreparing ()
 
void TransitionToMediaReady ()
 
void TransitionToPlaybackPlaying ()
 
void TransitionToPlaybackPaused ()
 
void TransitionToPlaybackBuffering ()
 
CYIAbstractVideoPlayer::PlayerState GetPlayerState () const
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
virtual bool IsConnected () const
 
virtual bool IsConnected (const CYISignalBase &rSignal) const
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 

Constructor & Destructor Documentation

◆ CYIVideoPlayerStateManager()

CYIVideoPlayerStateManager::CYIVideoPlayerStateManager ( CYIAbstractVideoPlayer pPlayer)

◆ ~CYIVideoPlayerStateManager()

virtual CYIVideoPlayerStateManager::~CYIVideoPlayerStateManager ( )
virtual

Member Function Documentation

◆ GetPlayerState()

CYIAbstractVideoPlayer::PlayerState CYIVideoPlayerStateManager::GetPlayerState ( ) const

Returns the current player state.

◆ TransitionToMediaPreparing()

void CYIVideoPlayerStateManager::TransitionToMediaPreparing ( )

Transitions the player into the CYIAbstractVideoPlayer::MediaState::Preparing state.

Note
Must be in the CYIAbstractVideoPlayer::MediaState::Unloaded state. See class description for more details.
This transition is required when implementing a CYIAbstractVideoPlayer.

◆ TransitionToMediaReady()

void CYIVideoPlayerStateManager::TransitionToMediaReady ( )

Transitions the player into the CYIAbstractVideoPlayer::MediaState::Ready state.

Note
Must be in the CYIAbstractVideoPlayer::MediaState::Preparing state. See class description for more details.
This transition is required when implementing a CYIAbstractVideoPlayer.

◆ TransitionToMediaUnloaded()

void CYIVideoPlayerStateManager::TransitionToMediaUnloaded ( )

Transitions the player into the CYIAbstractVideoPlayer::MediaState::Unloaded state.

Note
Valid from any state.
This transition is optional when implementing a CYIAbstractVideoPlayer as it is built into CYIAbstractVideoPlayer::Stop.

◆ TransitionToPlaybackBuffering()

void CYIVideoPlayerStateManager::TransitionToPlaybackBuffering ( )

Transitions the player into the CYIAbstractVideoPlayer::PlaybackState::Buffering state.

Note
Must be in the CYIAbstractVideoPlayer::MediaState::Ready state. See class description for more details.
This transition is required when implementing a CYIAbstractVideoPlayer.

◆ TransitionToPlaybackPaused()

void CYIVideoPlayerStateManager::TransitionToPlaybackPaused ( )

Transitions the player into the CYIAbstractVideoPlayer::PlaybackState::Paused state.

Note
Must be in the CYIAbstractVideoPlayer::MediaState::Ready state. See class description for more details.
This transition is required when implementing a CYIAbstractVideoPlayer.

◆ TransitionToPlaybackPlaying()

void CYIVideoPlayerStateManager::TransitionToPlaybackPlaying ( )

Transitions the player into the CYIAbstractVideoPlayer::PlaybackState::Playing state.

Note
Must be in the CYIAbstractVideoPlayer::MediaState::Ready state. See class description for more details.
This transition is required when implementing a CYIAbstractVideoPlayer.

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