Blackberry playing video from server

107 views Asked by At

Aim:

Play video in blackberry device from remote server.

Current Output

Blank screen and this message: "Press space to start/stop/resume playback."

My code

public class MyApp extends UiApplication
{
    private Player player;
    private VideoControl videoControl; 

    public static void main(String[] args)
    {
        MyApp theApp = new MyApp();       
        theApp.enterEventDispatcher();
    }

    public MyApp()
    {
            MainScreen ms = new MainScreen();

            public boolean onClose()
            {

                player.close();
                videoControl.setVisible(false);
                close();
                return true;
            }

            protected boolean keyChar(char c, int status, int time)
            {
                boolean retVal = false;
                if (c == Characters.SPACE)
                {
                    if (player.getState() == Player.STARTED)
                    {
                        //Stop playback.
                        try
                        {
                            player.stop();
                        }
                        catch (Exception ex)
                        {
                            System.out.println("Exception: " + ex.toString());
                        }
                    }
                    else
                    {
                        //Start playback.
                        try
                        {
                            player.start();
                        }
                        catch (Exception ex)
                        {
                            System.out.println("Exception: " + ex.toString());
                        }
                    }
                    retVal = true;
                }
                return retVal;
            }
        };

        ms.setTitle(new LabelField("Let's play some video..."));
        LabelField lf = new LabelField("Press space to start/stop/resume playback.");
        ms.add(lf);
        pushScreen(ms);

        try
        {

            player = Manager.createPlayer("http://224.1.2.3:12344:8082/ACSATraffic/blackberry.3gp");
            player.realize();

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


            videoControl.setVisible(true);
        }
        catch (Exception ex)
        {
            System.out.println(ex.toString());
        }
    }
}

}

What am I doing wrong here?

Or else is there any sample for playing video from local and server? A link would be greatly appreciated.

0

There are 0 answers