语言

Menu
Sites
Language
MediaPlayer::OpenUrlAsync method stops application

Hello everybody.

I have an problem with MediaPlayer method;

When i call MediaPlayer::OpenUrlAsync(const Tizen::Base::String& url, const Tizen::Base::String& filePath, IPlayerProgressiveDownloadListener& listener, const Tizen::Base::Collection::IMap* pHeader = null) 
to play audio stream its stop application (main thread) ,and i cant do anything.

How correct invoke this function?

Could someone give me example?

Thanks.

响应

16 回复
Alex Ashirov

Hi,

It should work. I used this API recently and it was ok. Could you please provide your code snippet? Then I will try to figure out what is wrong.

Egor Chebotarev

I use 

class PlayerForm:public IPlayerProgressiveDownloadListener{

__player->OpenUrlAsync(L"audioStreamURL",  filePath, *this,);

then when enter 

void PlayerForm::OnPlayerOpened(result r) {

__player->Play(); // here stop main thread

}

or call __pPlayer->Stop(); // here stop main thread

}

Alex Ashirov

As far as I understand main thread is stopped when you call Play(), but not OpenUrlAsync(). Right? if so, then could you please check what result is returned by OpenUrlAsync()?

Egor Chebotarev

String urlString = __radioHQUri.ToString();
r = __pPlayer->OpenUrlAsync(urlString,filePathURL,*this);
if(IsFailed(r))
{
AppLog("FAILED URL");
}

if(r== E_SUCCESS)
{
AppLog("E_SUCCESS URL");
}

 

The return of result is  E_SUCCESS

Alex Dem

Hi ,
Maybe it could help for debug:
1) try to check current state of Player before play/stop or before OpenUrlAsync() using Tizen::Media::Player::GetState()
2) try to check incoming parameter of OnPlayerOpened(), something like this:
void AudioService::OnPlayerOpened(result r)
{
    if(r == E_SUCCESS) {
        result res = mPlayer->Play();
    }
}

Alexey.

Egor Chebotarev

Some times it show error

 03-14 15:22:40.302 : INFO / ( 2678 : 2678 ) : virtual void PlayerForm::OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason)(1019) > PLAYER_ERROR_CONNECTION_LOST
 

Egor Chebotarev

And stranget error when invokemPlayer->stop()

03-14 15:30:51.072 : ERROR / Tizen::Base::Collection ( 3356 : 3356 ) : virtual Tizen::Base::Object* Tizen::Base::Collection::_ArrayListEnumerator::GetCurrent() const(71) > [E_INVALID_OPERATION] Current position(-1) is before the first element or past the last element.

Egor Chebotarev

This is a floating bug in  that line of code :

    AppLog("try to ClosePlayer");

r = __pPlayer->Close();

        AppLog("finish try to ClosePlayer"); // some times it is stop main  thread and never enter here.

 

Alex Ashirov

I have checked my sources. Actually, I used OpenUrlAsync(const Tizen::Base::String& url, const Tizen::Base::Collection::IMap* pHeader = null) instead of OpenUrlAsync(const Tizen::Base::String& url, const Tizen::Base::String& filePath, IPlayerProgressiveDownloadListener& listener, const Tizen::Base::Collection::IMap* pHeader = null). I didn't try a progressive download playback, but I am going to try it. I will update you when I will have some results.

Alex Ashirov

Hi,

Have you solved the issue? You can try to check player's state before call __pPlayer->Close() with GetState(). Probably the state is wrong.

Egor Chebotarev

Same issue happens when i call requestRedraw method.

I fix it and doest use it anymore.

But it does not help with player->Close().

 

Egor Chebotarev

Hello

"Have you solved the issue?"

No,yet.

" Probably the state is wrong"

I checked - the state is correct

Alex Ashirov

Hello,

What is state when the main thread hangs up PLAYER_STATE_OPENED or PLAYER_STATE_PLAYING?

Egor Chebotarev

Hello.

"What is state when the main thread hangs up PLAYER_STATE_OPENED or PLAYER_STATE_PLAYING?"


The state is E_SUCCESS.

Alex Ashirov

Hello,

E_SUCCESS is result, but I am asking about state returned by GetState() method. Its type is PlayerState.

Egor Chebotarev

When i try to close,and main thread stopps the state is STOPPED,because i do:

_player->Stop();

_player->Close()