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
New Developer
Posts: 32
Registered: ‎04-30-2009
My Device: Pearl 8120

Seeing video controls on video playback

Hi all,

I've followed the advice of other forum posts and have managed to get my code to stream video files correctly throught simulator and device (Pearl 8120).

Now, I'd like to actually present a play/pause control to the user, or in some way let the user know how they can pause the video file while they are playing it.

As I understand it, videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field")

should return a field that contains the GUI controls that can be presented to the user.

However, when I add that field to the screen, using the code below, I get a java.lang.NegativeArraySizeException on the add itself in the invokeLater().

 

                                VideoControl control = null;
                                // create a new VideoControl
                                if ((control = (VideoControl)tuple.player.getControl("VideoControl")) != null) {
                                    // initialize the video mode using a Field
                                    final Field field = (Field)control.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
                                    control.setVisible(true);
                                    UiApplication.getUiApplication().invokeLater(new Runnable() {
                                        public void run() {
                                            UiApplication.getUiApplication().getActiveScreen().add(field);
                                        }
                                    });
                                }
                               
                                tuple.player.prefetch(); // prefetch

 

While the NegativeArraySizeException is probably triggered by some other of my code, is my expectation of how to handle this the display of this field correct?  E.g. is it correct to capture the field returned by initDisplayMode, then to add it to the screen?

 

Thanks! 

 

 

 

New Developer
Posts: 32
Registered: ‎04-30-2009
My Device: Pearl 8120

Re: Seeing video controls on video playback

Update: the error is happening on the player.start() code a little further down.

So, I don't think it's an error with other parts of my code, but rather an error with how I am handling the Field.

 

Any thoughts or sample code out there?

Thanks.

BlackBerry Development Advisor
Posts: 15,753
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Seeing video controls on video playback

Please refer to the sample here:

 

How To - Play video within a BlackBerry smartphone application
Article Number: DB-00641

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How_To...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker