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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 1,638
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

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
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

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
Posts: 1,638
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

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
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Help: NowPlayingController block until Music starts.

Well, with the NowPlayingConnection Smiley Very 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
Posts: 1,638
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

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
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

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
Posts: 1,638
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

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