当前位置: 首页>>代码示例>>C++>>正文


C++ PlayerPtr::Play方法代码示例

本文整理汇总了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();
}
开发者ID:LeonJavaAndroid,项目名称:musikcube,代码行数:43,代码来源:Transport.cpp

示例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;
}
开发者ID:angeltown,项目名称:ethanon,代码行数:62,代码来源:DShowPlayer.cpp


注:本文中的PlayerPtr::Play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。