[Bada开发]播放实时rtsp流
bada是三星公司自主开发的移动操作系统,它的特点是配置灵活、用户交互性好、面向服务,非常重视SNS集成和地理位置服务应用。本文介绍了如何在bada平台实现播放实时rtsp流。
bada是三星公司自主开发的移动操作系统,它的特点是配置灵活、用户交互性好、面向服务,非常重视SNS集成和地理位置服务应用。bada的设计目标是开创人人能用智能手机的时代。本文介绍了如何在bada平台实现播放实时rtsp流。
使用Osp::Media::Player类
- The supported formats in streaming
- Video : H.264, H.263, MPEG4
- Audio : AMR-NB, AAC, AAC+, EAAC+
- The supported protocol in streaming
- RTSP
- {
- __pPanel= new OverlayPanel();
- __pPanel->Construct(Rectangle(0,58,480,560));
- AddControl(*__pPanel);
- __pPlayer = new Player();
- Osp::Graphics::BufferInfo bufferInfo;
- r = __pPanel->GetBackgroundBufferInfo(bufferInfo);
- __pListener = new VideoPlayerListener;
- r = __pPlayer->Construct(*__pListener, &bufferInfo);
- VideoPlayerPlay();
- }
- void
- VideoPlayerForm::VideoPlayerPlay()
- {
- result r = E_SUCCESS;
- if(openFlag == false)
- {
- String resolveString(L"rtsp://***");
- Uri baseUri;
- baseUri.SetUri(resolveString);
- r = __pPlayer->OpenUrl(baseUri);
- r = __pPlayer->Play();
- openFlag = true;
- }
- else
- {
- AppLog("file being played");
- }
- }
- //因为播放的是实时流媒体,暂停时直接停止,再次恢复时重新建立连接(调用VideoPlayerPlay())
- void
- VideoPlayerForm::VideoPlayerPause()
- {
- result r = E_SUCCESS;
- PlayerState nowState = __pPlayer->GetState();
- if(nowState == PLAYER_STATE_PLAYING)
- {
- AppLog("stop");
- r = __pPlayer->Stop();
- if(IsFailed(r))
- {
- AppLog(">>>>>> (VideoPlayer::VideoPlayerStop) Stop has failed: %s\n", GetErrorMessage(r));
- return;
- }
- r = __pPlayer->Close();
- if(IsFailed(r))
- {
- AppLog(">>>>>> (VideoPlayer::VideoPlayerStop) Close has failed: %s\n", GetErrorMessage(r));
- return;
- }
- openFlag = false;
- }
- else
- {
- AppLog("file does not play");
- }
- }