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
Robdob
Posts: 225
Registered: ‎01-31-2013
My Device: Developer

How do I launch a video located within my assets folder from within QML using Invocation .

Hi,

 

Can someone please tell me how to launch a video ( .mp4 ) file located within my assets folder from wihtin qml using Invocation.  So far I have the following but it doesn't seem to work..

 

thanks,:

 

Button

{

 text: "Launch Video"

onClicked

: {

invokeVideo.trigger("bb.action.OPEN");

}

}

 

//

attachedObjects:

[

Invocation

{

 

id: invokeVideo

 

query{

invokeTargetId: "sys.mediaplayer.previewer"

uri: "asset:///video/myVideo.mp4"

}

}

]



GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!
Please use plain text.
Developer
BBSJdev
Posts: 6,094
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How do I launch a video located within my assets folder from within QML using Invocation .

[ Edited ]

By design no other app has access to your app's secure areas.

You wiill need to copy it to a shared folder first.

 

Please use the 'Insert Code' button when adding code to make it more legible, the clipboard icon with a C.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
BBSJdev
Posts: 6,094
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How do I launch a video located within my assets folder from within QML using Invocation .

[ Edited ]

Is there a reason you can't use MediaPlayer directly...

 

http://developer.blackberry.com/native/documentation/cascades/graphics_multimedia/audio_video/playin...


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
Robdob
Posts: 225
Registered: ‎01-31-2013
My Device: Developer

Re: How do I launch a video located within my assets folder from within QML using Invocation .

Hi,

 

thanks for the info,  it makes sense,  however even if I try ti access a test.mp4 from the web using my code above nothing happens. 

 

i.e.: https://archive.org/download/Pbtestfilemp4videotestmp4/video_test.mp4

 

it works from within c, but can you tell me why it doesn't appear to work using my qml above?

 

Thanks,



GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!
Please use plain text.
Developer
Robdob
Posts: 225
Registered: ‎01-31-2013
My Device: Developer

Re: How do I launch a video located within my assets folder from within QML using Invocation .

Hi,

 

the media player works fine,  but I don't want to recreate the UI ( play, seek, progress bar etc )that I would automatically obtain using invocation in order to access it as an asset.  it would be easier to copy the file elsewhere as you have suggested.



GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!
Please use plain text.
BlackBerry Development Advisor (Retired)
s_rashid
Posts: 127
Registered: ‎02-27-2012
My Device: Bold
My Carrier: Rogers

Re: How do I launch a video located within my assets folder from within QML using Invocation .

 

Hi @RobDob,

I believe there was a known issue on the OS around 10.2 for not being able to match the invocation target ID. This should be fixed with the recent 10.2.1 OS update release. You can also find the corresponding autoloader.exe for your developer device/hardware model from here: https://developer.blackberry.com/devzone/blackberry10devalpha/allautoloaders.html

 

To verify that you are indeed getting the same problem, I faced the following when I attempted your code:

InvocationWrapper::onQueryFinished: no matching result from Menu Service for query
   mimeType=""
   uri=QUrl("http://ia600204.us.archive.org/2/items/Pbtestfilemp4videotestmp4/video_test.mp4") 
   data= "" 
   metadata= QMap() 
   perimeter= 0 
   action= "" 
   target= "sys.mediaplayer.previewer" 
   invokerIncluded= false 
InvocationPrivate::onQueryResolved: no result matching query, no armed signal sent. 

 

Is that what you were getting? Can you try with the latest 10.2.1 public OS?
Also, note that "https" isn't listed on the MediaPlayer card documentation (http) is.

Cheers,
Rashid

Application Development Consultant | Developer Relations

BlackBerry
@surashid




Please use plain text.
BlackBerry Development Advisor (Retired)
s_rashid
Posts: 127
Registered: ‎02-27-2012
My Device: Bold
My Carrier: Rogers

Re: How do I launch a video located within my assets folder from within QML using Invocation .

Oops; pasted the wrong URL for getting the latest 10.2.1 OS image for your developer device(s). It should be this:
https://developer.blackberry.com/devzone/blackberry10devalpha/devalpha_update.html

 

Also, to reiterate some of the items discussed in the thread for MediaPlayer card app:

- Yes, it makes sense to just invoke the core MediaPreviewer card for simple playback functionalities. This bypasses the need to make your UI with playback controls and you get several other core functionalities for free. For example, it uses NowPlayingConnection feature by default (hardware shortcut keys integration, metadata overlay, pauses/resumes accordingly when other higher priority playback occurs). It also provides Share (social networks/emails) and *Play On* features for free (HDMI, Miracast, etc)

 

- But note that invoking a separate app (MediaPlayer card is in fact a separate) doesn't allow you to change any of its UI (you can only change the title text shown and thumbnail for audio items). Even then, you have to make sure that the app has access to all these URIs being sent as a parameter

 

- Note that you cannot play encrypted content (at least not yet) using the MediaPlayer card app or even the Cascades MediaPlayer API; there isn't any to pass the decryption keys in either one of these. For now, if you do have to decrypt any content, you'd have to use the C mm-renderer API

 

Cheers,
Rashid

Application Development Consultant | Developer Relations

BlackBerry
@surashid

Please use plain text.
BlackBerry Development Advisor (Retired)
s_rashid
Posts: 127
Registered: ‎02-27-2012
My Device: Bold
My Carrier: Rogers

Re: How do I launch a video located within my assets folder from within QML using Invocation .


Update:

We investigated the root cause of this. It turns out that there was a minor documentation error for the MediaPlayer card app invocation; this should read that it supports"bb.action.VIEW" instead of "bb.action.OPEN". Unfortunately, the VIEW operations were not designed to be invoked from the menu service (used for querying and figuring out the target ID); hence, the MediaPlayer card app won't work from QML. Your only solution for now would be to just keep using it from C++ code, using InvokeManager. Apologies for the confusion.

Sincerely,
Rashid

Application Development Consultant | Developer Relations

BlackBerry
@surashid

Please use plain text.