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
Posts: 32
Registered: ‎04-21-2013
My Device: Z10, Z30

Question about WebView and Media Player

I've got an application that at one point opens a page to a webview, and within the webview sets the url to an html video player.

 

The video player works just fine within the webview, however I have noticed that it provides media controls that BB10 seems to recognize. I can pause the playback with the built in html play button. I can even set the media to play in full screen using a button that the embeded player provides.

 

Here is the code:

 

import bb.cascades 1.3
import bb.multimedia 1.2
  
// ...

Page {
    id: streamPage
    resizeBehavior: PageResizeBehavior.Resize
    actionBarVisibility: ChromeVisibility.Compact

    Container {
        id: webLayouts
        layout: StackLayout {
        }
        WebView {
            id: streamView
            url: null
            preferredHeight: ui.du(80)
            horizontalAlignment: HorizontalAlignment.Fill
        }   
    }
    function setHTML(channel){
        console.log("Channel setting to:  " +channel)
        streamView.url = 'URL_OF_HTML5_MEDIA_PLAYER'+channel+'/hls' //html5
    }

}

 Now, I have also noticed that the BB10 hardware buttons can control the playback of the embedded media. My question is, what is exactly happening when embedded media, such as the HTML5 player I have loaded, plays on the device. How do I control the media through Cascades? Instead of the WebView, could I instantiate a media player and set the source url to the HTML5 player I have been embedding?

 

My ultimate goal is to control the playback of the media through custom UI components that I specify, rather than the ones provided by the embedded player.

Highlighted
Developer
Posts: 222
Registered: ‎10-19-2012
My Device: Playbook, BB10DevAlphaB/C, Z10
My Carrier: Sonera, Saunalahti

Re: Question about WebView and Media Player

Do you have a specific reason to use HTML for the player ?

If you can access the media directly and need to control it yourself then the best choice would be to use the Cascades multimedia controllers instead.


Kaj-Michael Lang, Home.
Author of: Onki and RetroPlayer
Developer
Posts: 32
Registered: ‎04-21-2013
My Device: Z10, Z30

Re: Question about WebView and Media Player

I only have access to the url of the html5 media player, I do not nessesarily have access to the raw video streams.

Developer
Posts: 358
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: Question about WebView and Media Player

Looking for a solution to this as well.