本文整理汇总了C++中PlayerPtr::Play方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPtr::Play方法的具体用法?C++ PlayerPtr::Play怎么用?C++ PlayerPtr::Play使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPtr
的用法示例。
在下文中一共展示了PlayerPtr::Play方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Start
void Transport::Start(utfstring url){
#ifdef _DEBUG
std::cerr << "Transport::Start called" << std::endl;
#endif
// Check if this is already Prepared
PlayerPtr player = this->nextPlayer;
this->nextPlayer.reset();
#ifdef _DEBUG
std::cerr << "Transport: nextPlayer reset" << std::endl;
#endif
// If the nextPlayer wasn't the same as the one started, lets create a new one
if(!player || player->url!=url){
// Or create a new player
Player::OutputPtr output;
#ifdef _DEBUG
std::cerr << "Transport: new output created for player" << std::endl;
#endif
player = Player::Create(url, &output);
player->SetVolume(this->volume);
#ifdef _DEBUG
std::cerr << "Transport: new player created" << std::endl;
#endif
}
// Add to the players
this->players.push_front(player);
this->currentPlayer = player;
#ifdef _DEBUG
std::cerr << "Transport: player added to player list" << std::endl;
#endif
// Lets connect to the signals of the currentPlayer
this->currentPlayer->PlaybackStarted.connect(this,&Transport::OnPlaybackStarted);
this->currentPlayer->PlaybackAlmostEnded.connect(this,&Transport::OnPlaybackAlmostEnded);
this->currentPlayer->PlaybackEnded.connect(this,&Transport::OnPlaybackEnded);
this->currentPlayer->PlaybackError.connect(this, &Transport::OnPlaybackError);
#ifdef _DEBUG
std::cerr << "Transport: player-Play() about to be called" << std::endl;
#endif
// Start playing
player->Play();
}
示例2: PlayCutscene
GS_PLAYER_INFO PlayCutscene(VideoPtr pVideo, const std::wstring& fileName,
InputPtr pInput, const GS_KEY escapeKey)
{
if (!pVideo)
{
ShowMessage(L"Invalid video handler - gs2d::PlayCutscene", GSMT_ERROR);
return GSPI_FAILED;
}
GS_PLAYER_INFO info = GSPI_FINISHED;
//pVideo->TurnLoopManagerOff();
const bool rendering = pVideo->Rendering();
if (rendering)
pVideo->EndSpriteScene();
PlayerPtr player = CreatePlayer(pVideo, fileName);
if (!player)
{
ShowMessage(L"Failed while trying to load the video - gs2d::PlayCutscene", GSMT_ERROR);
if (rendering)
pVideo->BeginSpriteScene();
return GSPI_FAILED;
}
pVideo->EnableMediaPlaying(true);
player->SetFullscreen();
player->Rewind();
player->Play();
while (!player->IsFinished())
{
player->UpdateVideo();
const Video::APP_STATUS status = pVideo->HandleEvents();
if (status == Video::APP_QUIT)
{
info = GSPI_CLOSE_WINDOW;
break;
}
else
{
if (status == Video::APP_SKIP)
continue;
}
if (pInput)
{
pInput->Update();
if (pInput->GetKeyState(escapeKey) == GSKS_HIT)
{
info = GSPI_SKIPPED;
break;
}
}
}
if (rendering)
pVideo->BeginSpriteScene();
pVideo->EnableMediaPlaying(false);
return info;
}