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
Contributor
Posts: 27
Registered: ‎09-03-2012
My Device: Blackberry Playbook
My Carrier: None

has anyone used Navigator_Invoke?

hi

trying to use the navigator_invoke function to open an image or video file.

 

I think I should be able to do:

 

char* dummy = 0;
navigator_invoke("videos://accounts/1000/shared/videos/cover.mp4", &dummy);

or

navigator_invoke("photos://accounts/1000/shared/videos/cover.png", &dummy);

I also tried:

navigator_invoke("//accounts/1000/shared/videos/cover.mp4", &dummy);
navigator_invoke("shared/videos/cover.mp4", &dummy);
navigator_invoke("//accounts/1000/shared/videos/cover.png", &dummy);
navigator_invoke("shared/videos/cover.png", &dummy);

 Always the same result. For images, it opens the image app but not the image I specified, just the default Pictures app with a folder for Camera, one for All Pictures and one for Wallpaper.

 

For videos, it tries to open the video player but gives a popup:

 

Media Error

Cannot open the file. Please check the file permissions and try again.

 

If I put in a rubbish name I get the same error so I'm sure its just me not getting the string format right. Does anyone have an example for opening a video in the shared folder?

 

many thanks

 

Contributor
Posts: 27
Registered: ‎09-03-2012
My Device: Blackberry Playbook
My Carrier: None

Re: has anyone used Navigator_Invoke?

I should have said, I'm using the Native SDK 2.1 and I also tried:

navigator_invoke("videos:///accounts/1000/shared/videos/shared.mp4", &dummy);

 but with same result

Contributor
Posts: 27
Registered: ‎09-03-2012
My Device: Blackberry Playbook
My Carrier: None

Re: has anyone used Navigator_Invoke?

Anyone? Smiley Happy

 

Surely someone from Blackberry must know how to use their own published API?!

Retired
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: has anyone used Navigator_Invoke?

Hi there, welcome to the forums!

 

Have you looked at the Media example on the samples page?

https://developer.blackberry.com/native/sampleapps/

 

Are you using the simulator or the actual device?

 

Martin

 

Contributor
Posts: 27
Registered: ‎09-03-2012
My Device: Blackberry Playbook
My Carrier: None

Re: has anyone used Navigator_Invoke?

hi Martin

thanks for the welcome Smiley Happy

 

I did look at all the examples, yes. The Multimedia examples focus on using the mmr (Multimedia Renderer) but as I'm using Qt, if I use mmr to play a video I can hear it but can't see the video, its stuck behind a black window (there are other threads discussing this but no solution). 

So I thought a easier option for me was to ask Playbook to manage the playback of the video, using navigator_invoke.

I could not see any sample using navigator_invoke.

 

Here the SDK documentation says I can call navigator_invoke passing 

videos://file_URL - Opens the videos application and plays the specified file

 

But, as I said already, I can't get this to work; if you can provide a one line example showing how to call this API for a file in the shared folder I'd really appreciate it

 

many thanks

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: has anyone used Navigator_Invoke?

Can you try

 

char **err;
navigator_invoke("videos://shared.mp4", err);
fprintf(stderr, "The error: %s\n", *err);
bps_free(*err);

 

Contributor
Posts: 27
Registered: ‎09-03-2012
My Device: Blackberry Playbook
My Carrier: None

Re: has anyone used Navigator_Invoke?

hi Martin

did you try your example? It just crashes for me, do I need to initialiate the char err?

 

I tried:

char *err = (char *) malloc(sizeof(char) * 1000);
navigator_invoke("videos://shared.mp4", &err);
printf(err);

 

But I get garbage out Smiley Sad

Can you please try your example and advise.

 

Just to go back to my original question, my videos are in a shared folder. I can't just put a file in the shared folder (it comes up as Y: on my PC), files have to go in folders on that drive. So I can never have shared.mp4 in the top level folder, does it not have to go in a folder like videos?

 

thanks for you help

Contributor
Posts: 27
Registered: ‎09-03-2012
My Device: Blackberry Playbook
My Carrier: None

Re: has anyone used Navigator_Invoke? Anyone at RIM tried it??

I really like the playbook. I have a couple of apps in Apples App Store and I'd love to code for the playbook. But...

I posted a question 5 days ago asking for someone to confirm the format of a published api...nothing. Isit just me? How do you guys code when APIs are half documented and don't seem to work, and little to no support on this forum from RIM. 

 

Retired
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: has anyone used Navigator_Invoke? Anyone at RIM tried it??

Unfortunately my focus of expertise is the BB10 platform -

 

In your bar-descriptor.xml file, have you tried adding/uncommeting the following action?

<!--  <action>access_shared</action> -->

This wil lallow you to access the shared section on the device;

 

Let me know if this helps!

 

Martin

Contributor
Posts: 27
Registered: ‎09-03-2012
My Device: Blackberry Playbook
My Carrier: None

Re: has anyone used Navigator_Invoke? Anyone at RIM tried it??

hi Martin

yep, I have that in my bar-descriptor.xml. So yu recommend I give up on Navtive and move to BB10?

I currently have a playbook so I can debug using it. But without a BB10 Alpha device, trying to get the BB10 simulator to work properly is a discussion for another thread Smiley Happy