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
Regular Contributor
kaushik_saha
Posts: 55
Registered: ‎09-01-2010
My Device: Not Specified

Blackberry video with text display problem

I need a video screen and under the video play, I want to show two lines of text like below.

 

man_wi10.jpg

 

For that I am using following code.

 

public final class PlayVideoScreen extends MainScreen {
    private Player player;
    private VideoControl videoControl;

    public PlayVideoScreen() {

        // ms.setTitle(new LabelField("Let's play some video..."));
        LabelField lf = new LabelField("Video Play");
        
        try {
            // Create a new Player pointing to the video file.
            // This can use any valid URL.
            player = javax.microedition.media.Manager
                    .createPlayer("file:///SDCard/BlackBerry/videos/sample.avi");
            
            player.realize();

            // Create a new VideoControl.
            videoControl = (VideoControl) player.getControl("VideoControl");
            // Initialize the video mode using a Field.
            Field videoField = (Field) videoControl.initDisplayMode(
                    VideoControl.USE_GUI_PRIMITIVE,
                    "net.rim.device.api.ui.Field");

            add(videoField);
            
            VolumeControl volume = (VolumeControl) player
                    .getControl("VolumeControl");
            volume.setLevel(30);
            

            player.start();

            // Set the video control to be visible.
            // videoControl.setVisible(true);
        } catch (MediaException me) {
            Dialog.alert(me.toString());
        } catch (IOException ioe) {
            Dialog.alert(ioe.toString());
        }

        add(lf);

         LabelField lf2 = new LabelField("How r you?");

         add(lf2);
    }

    public boolean onClose() {
        // Clean up the player resources.
        player.close();
        videoControl.setVisible(false);
        close();
        return true;
    }
}

 

Now what is may be the height of video, the view is taking scroll and the text is only visible after scrolling. I am using a device of screen size 320X240px. I have even test with a video of 320X150px. But the text is not visible without scrolling, although there is lots of free space above and bottom of the video. What is problem in my code? How to solve it?

Please use plain text.
BlackBerry Development Advisor (Retired)
psapra
Posts: 74
Registered: ‎07-22-2008
My Device: BlackBerry Z10
My Carrier: N/A

Re: Blackberry video with text display problem

Can you try scalling the VideoControl by calling setDisplaySize(320,150)?  Please see the below KB article for more details. 

 

http://supportforums.blackberry.com/t5/Java-Development/Position-a-Video-within-a-Screen/ta-p/552062

 

 

Thanks,
Pratik Sapra
Gaming & Apps Consultant
Developer Relations
@pratiksapra
Please use plain text.