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
Super Contributor
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook
My Carrier: NA
Accepted Solution

Invoking - Cards

I invoke the media player as a card. It comes on the display and when I swipe back to my app the music stops playing. Is there a way to keep the music playing and switch between my app and the card so that the user can change volume etc.

 

Thanks

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
New Contributor
Posts: 6
Registered: ‎08-23-2013
My Device: Z10
My Carrier: Entel

Re: Invoking - Cards

Hi, can you please share your code, i con't get pure QML code to work

 

Invocation {
                        id: mediaInvocation
                        query {
                            invokeTargetId: "sys.mediaplayer.previewer"
                            mimeType: "audio/mpeg"
                            invokeActionId: "bb.action.OPEN"
                            onQueryChanged: {
                                mediaInvocation.query.updateQuery()
                            }
                        }
                        onArmed: {
                            trigger("bb.action.OPEN");
                        }
                    }

 and on click

 

mediaInvocation.query.uri = dataModel.data(indexPath).enclosure.url
mediaInvocation.trigger("bb.action.OPEN")

 

Super Contributor
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook
My Carrier: NA

Re: Invoking - Cards

I used C++ and a file picker/media player. The user selects a file and on selection the media player is invoked.

 

//MEDIA PLAYER
	mp = new MediaPlayer();
	mp->isSeekable();

	//FILE PICKER
	filePicker = new FilePicker();
	filePicker->setType(FileType::Music);
	filePicker->setTitle("Select Music");
	filePicker->setMode(FilePickerMode::Picker);
	QObject::connect(filePicker, SIGNAL(fileSelected(const QStringList&)),this,SLOT(onFileSelected(const QStringList&)));

void ControllerDrumKit::onFileSelected(QStringList list)
{

       mp->setSourceUrl(QString(list[0]));
	mp->play();

}

 Hope this helps.

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Highlighted
Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Invoking - Cards

To answer the original question, incase anyone turns up here later: No, the playback is being handled by the card. Once the card is gone, the playback has to stop. If you want it to keep playing, you have have to play the file yourself inside your app, which is what I assume Jeff has done.

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