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::MEDIA_STATE and CYIAbstractVideoPlayer::PLAYBACK_STATE. The state diagram is displayed below:

video-player-states.png

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

The CYIAbstractVideoPlayer::PLAYBACK_STATE represents the state of media playback in the player. There are three states in the CYIAbstractVideoPlayer::PLAYBACK_STATE. 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 ( CYIAbstractVideoPlayer pPlayer)
virtual CYIVideoPlayerStateManager::~CYIVideoPlayerStateManager ( )
virtual

Member Function Documentation

CYIAbstractVideoPlayer::PlayerState CYIVideoPlayerStateManager::GetPlayerState ( ) const

Returns the current player state.

void CYIVideoPlayerStateManager::TransitionToMediaPreparing ( )

Transitions the player into the CYIAbstractVideoPlayer::MEDIA_PREPARING state.

Note
Must be in the CYIAbstractVideoPlayer::MEDIA_UNLOADED state. See class description for more details.
This transition is required when implementing a CYIAbstractVideoPlayer.
void CYIVideoPlayerStateManager::TransitionToMediaReady ( )

Transitions the player into the CYIAbstractVideoPlayer::MEDIA_READY state.

Note
Must be in the CYIAbstractVideoPlayer::MEDIA_PREPARING state. See class description for more details.
This transition is required when implementing a CYIAbstractVideoPlayer.
void CYIVideoPlayerStateManager::TransitionToMediaUnloaded ( )

Transitions the player into the CYIAbstractVideoPlayer::MEDIA_UNLOADED state.

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

Transitions the player into the CYIAbstractVideoPlayer::PLAYBACK_BUFFERING state.

Note
Must be in the CYIAbstractVideoPlayer::MEDIA_READY state. See class description for more details.
This transition is required when implementing a CYIAbstractVideoPlayer.
void CYIVideoPlayerStateManager::TransitionToPlaybackPaused ( )

Transitions the player into the CYIAbstractVideoPlayer::PLAYBACK_PAUSED state.

Note
Must be in the CYIAbstractVideoPlayer::MEDIA_READY state. See class description for more details.
This transition is required when implementing a CYIAbstractVideoPlayer.
void CYIVideoPlayerStateManager::TransitionToPlaybackPlaying ( )

Transitions the player into the CYIAbstractVideoPlayer::PLAYBACK_PLAYING state.

Note
Must be in the CYIAbstractVideoPlayer::MEDIA_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: