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

Java Development

Reply
Forums Advisor I
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10
Accepted Solution

Playing audio and video in one player?

Hi

Is it possible to play audio and video is the same player??

If i give the video url video will play and same for sound??

Highlighted
Developer
Posts: 121
Registered: ‎05-31-2012
My Device: 9900
My Carrier: Airtel

Re: Playing audio and video in one player?

I think you can do a work arround as follows--

 

In both cases you create the plyaer in same way--

 

Player player = Manager.createPlayer(urlToPla);
player.realize();

 

But in case of video we get the VideoControl and get the associated field to display .

 

VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
            Field videoField = (Field) videoControl.initDisplayMode(
                    VideoControl.USE_GUI_PRIMITIVE,
            "net.rim.device.api.ui.Field");


and then we add this field to Screen/Manager.

 

So first check if you get the field correctly before adding(as in case of audio this may be null)--

 

if (videoField != null){

add(videoField);

}

 


I have not tried it but give it a try it may help.

Rishikesh Singh