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

Web and WebWorks Development

Reply
New Developer
Posts: 6
Registered: ‎05-19-2011
My Device: playbook
My Carrier: no
Accepted Solution

webworks invoke

[ Edited ]

is it possible to launch media player invoke.JavaArguments using http://blackberry-webworks.github.com/WebWorks-API-Docs/WebWorks-API-Docs/view/blackberry.invoke.Jav... ?

 

i've tried following method with no success:

 

function launch_media_player()
{
   try
       {
            var params = new Array();
            params[0] = 'http://somesite.com/somefile.mp3
            var args = new blackberry.invoke.JavaArguments('net_rim_bb_mediacontenthandler', params);
            blackberry.invoke.invoke(blackberry.invoke.APP_JAVA, args);
       }
   catch (e) {
    alert('exception (launch_media_player): ' + e.name + '; ' + e.message);
   }
}

launch_media_player();

Highlighted
Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: webworks invoke

No that is not possible.  The reason why is because most apps created by RIM (e.g. media player) do not allow 3rd party applications to feed them parameters.  This is why the blackberry.invoke.APP_MUSIC constant was provided so you could invoke directly to the media player (but no params unfortunately).

 

With your code, I might expect the media player could be opened, by targeting the module directly, but it would not start playing somefile.mp3.  Is that what you are seeing?

 

Are you targeting BlackBerry 7?  If so you may be able to use the HTML5 audio element instead.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
New Developer
Posts: 6
Registered: ‎05-19-2011
My Device: playbook
My Carrier: no

Re: webworks invoke

thanks for such complete answer, and sorry for such a big delay Smiley Happy