1. VimalSandy's Avatar
    class VideoView extends MainScreen
    {
    private Player _player;
    private Field _videoField;
    private VideoControl _vc;

    // Constructor
    public VideoView(final BrdcstMessage msg)
    {
    super(net.rim.device.api.ui.Manager.NO_VERTICAL_SC ROLL);

    System.out.println("*****initVideo over*");


    initVideo(msg._MsgUrl); //msg._MsgUrl = rtsp://website addess/some.3gp;

    if(_videoField != null)
    {
    System.out.println("*****_videoField*"+_videoField );
    displayVideo();
    System.out.println("*****displayVideo over*");
    }
    }


    private void setVideoSize(int width, int height)
    {
    try
    {
    if (_vc != null)
    {
    System.out.println("set video size");
    _vc.setDisplaySize(width, height);
    System.out.println("set video size---------");
    }
    }
    catch(MediaException pe)
    {
    System.out.println(pe.toString());
    }
    }

    /**
    * Creates and initializes a video player
    * @param url The URL of the video file to play
    */
    private void initVideo(String url)
    {
    try
    {
    _player = javax.microedition.media.Manager.createPlayer(url) ;
    _player.realize();
    System.out.println("*****_player *"+_player);
    _vc = (VideoControl) _player.getControl("VideoControl");
    System.out.println("*****_vc *"+_vc);
    if (_vc != null)
    {
    _videoField = (Field) _vc.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
    System.out.println("*****_videoField *"+_videoField);
    _vc.setVisible(true);
    }
    }
    catch(MediaException pe)
    {
    System.out.println("--------initVideo-----MediaException="+pe.getMessage());
    }
    catch (IOException ioe)
    {
    System.out.println("--------initVideo-----MediaException="+ioe.getMessage());
    }
    }

    private void displayVideo()
    {
    // setTitle("Send Media Demo");
    add(_videoField);
    System.out.println("*****displayVideo-----------_videoField added*");

    try
    {
    // Start media player
    _player.start();
    System.out.println("*****displayVideo-------------_player started*");
    }
    catch(MediaException pe)
    {
    System.out.println("--------displayVideo-----MediaException="+pe.getMessage());
    }
    }

    protected void sublayout(int width, int height)
    {
    System.out.println("--------sublayout");
    setVideoSize(Display.getWidth(), Display.getHeight());

    super.sublayout(width, height);
    }


    public boolean onClose()
    {
    System.out.println("--------onClose");
    _player.close();
    System.out.println("onClose");
    return super.onClose();
    }
    }

    this is my code. i create media player to play the video file from server... when i try to run that i got some error.. the following error is


    Thread [net_rim_services_impl(5)id=441311232] (Suspended (exception UnsupportedOperationException))
    MediaPlayer.mediaLoaded(int) line: 622
    MediaNatives$MediaNativesEventDispatcher.dispatch( Message, Object) line: 386
    EventDispatchManager.dispatch(int, Message, Object[]) line: 59
    Proxy(Application).processNextMessage(Message) line: 1704
    Proxy(Application).enterEventDispatcher() line: 991
    ServiceStartup.tier0() line: 90
    ServiceStartup.main(String[]) line:

    can u please tell me what is the problem in that code.. say some solution for that pls..
    07-12-11 01:45 AM
  2. T
    What is this, code for some virus?

    Posted from my CrackBerry at wapforums.crackberry.com
    07-12-11 02:03 AM
  3. VimalSandy's Avatar
    this is a code for play video file in blackberry.. i got some error.. i mension above.. can u pls help me
    07-12-11 02:22 AM
  4. VimalSandy's Avatar
    anybody reply for this post
    07-12-11 05:12 AM
  5. albee 1's Avatar
    Why do you NOT have video capabilities? All blackberrys support video playback and record. If the format is not compatible there are many free converters available.

    Posted from my CrackBerry at wapforums.crackberry.com
    07-12-11 09:39 AM
  6. VimalSandy's Avatar
    i create a application to play the 3gp video files through RTSP server.. im using curve 8900.. the bb os is 4.6.1. when try to play the file.. my simulator is play video only one second then its freeze.. then i got above error as i mension earlier.. can u describe that what is the error.. why its coming..
    07-13-11 12:08 AM
LINK TO POST COPIED TO CLIPBOARD