Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Help: NowPlayingController block until Music starts.

I'm using

 

    NowPlayingController *npc = new NowPlayingController(this);

 

this will block and my app freezes until music starts to play.  why?

Is there a way to check if NowPlaying is active?

Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30

Re: Help: NowPlayingController block until Music starts.

It's designed to be used in tandem with a NowPlayingConnection. Do you have one of those set up?

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: Help: NowPlayingController block until Music starts.


PBernhardt wrote:

It's designed to be used in tandem with a NowPlayingConnection. Do you have one of those set up?


HI Paul, No. I do not have NowPlaying started.  I just need to know if NowPlaying is active.

 

Is there a way to detect if NowPlaying is active?

Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30

Re: Help: NowPlayingController block until Music starts.

Well, with the NowPlayingConnection :smileyvery-happy:

 

That has a mediaState property that tells you the current state of what's being played.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: Help: NowPlayingController block until Music starts.

Paul,

 

Not having any luck.  NowPlayingConnection() does give the current mediaState when NowPlaying is playing a sound.

 

I also tried the listen for the mediaState and not getting the signal

 

    NowPlayingConnection *np = new NowPlayingConnection(this);
    bool ok = connect(np, SIGNAL(mediaStateChanged (bb::multimedia::MediaState::Type)), this, SLOT(OnmediaStateChanged(bb::multimedia::MediaState::Type)));

is there permission that i'm missing?

 

Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30

Re: Help: NowPlayingController block until Music starts.


smiley wrote:

Paul,

 

Not having any luck.  NowPlayingConnection() does give the current mediaState when NowPlaying is playing a sound.

 

I also tried the listen for the mediaState and not getting the signal

 

    NowPlayingConnection *np = new NowPlayingConnection(this);
    bool ok = connect(np, SIGNAL(mediaStateChanged (bb::multimedia::MediaState::Type)), this, SLOT(OnmediaStateChanged(bb::multimedia::MediaState::Type)));

is there permission that i'm missing?

 


It does or doesn't give the current mediaState?

 

You shouldn't need a special permission. Are you sure the audio being played is something that's using the NowPlayingService? The media player does, for example, but not all 3rd party media apps do.

 

Are you seeing anything suspicuous in the logs?

 

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: Help: NowPlayingController block until Music starts.

It does NOT.

 

When I declare a new NowPlayingConnection() and then check the mediaState is shows Stopped.  I don't think it even have access to the current NowPlaying state.

 

I'm using the Music app to play a sound then I debug my app so i know it is using NowPlaying.

 

I don't see how NowPlayingConnection() can tell what is playing or it is playing anything in NowPlaying