×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    5

    Live video streaming using J2ME

    Hi All,
    I am trying to test live video streaming in symbian phones by using J2ME midlets. I got an rtsp link for watching live stream of a TV channel
    (rtsp://ss1c6.idc.mundu.tv:554/prf0/cid_4.sdp).
    I used this url in the midlet code in order to play the video. The code is as follows
    Code:
    public class VideoCanvas extends Canvas implements PlayerListener, CommandListener {
    
    private VidMidlet midlet = null;
    private Command start = new Command("Start",Command.OK,0);
    private Command stop = new Command("Stop",Command.OK,0);
    private Command back = new Command("Back",Command.OK,0);
    private Command exit = new Command("Exit",Command.BACK,0);
    private String url = "rtsp://ss1c6.idc.mundu.tv:554/prf0/cid_4.sdp";
    private String status = "Press left softkey";
    private String status2 = "";
    private Player player = null;
    private VideoControl control = null;
    
    public VideoCanvas(VidMidlet midlet) {
    this.midlet = midlet;
    //this.url = null;
    addCommand(start);
    addCommand(stop);
    addCommand(back);
    addCommand(exit);
    setCommandListener(this);
    this.setFullScreenMode(true);
    }
    
    public void commandAction(Command c, Displayable arg1) {
    if(c == start) {
    start();
    }
    else if(c == stop) {
    stop();
    }
    else if(c == exit) {
    midlet.notifyDestroyed();
    }
    else if(c == back) {
    Display.getDisplay(midlet).setCurrent(midlet.list);
    }
    
    }
    
    
    protected void paint(Graphics g) {
    g.setColor(255,255,255);
    g.fillRect(0,0,getWidth(),getHeight());
    g.setColor(0,0,0);
    g.drawString(status2,0,0,Graphics.LEFT|Graphics.TOP);
    g.drawString(status,getWidth(),getHeight(),Graphics.RIGHT|Graphics.BOTTOM);
    }
    
    
    public void start() {
    try {
    player = Manager.createPlayer(url);
    player.addPlayerListener(this);
    player.realize();
    
    
    // Grab the video control and set it to the current display.
    control = (VideoControl)player.getControl("VideoControl");
    if (control != null) {
    control.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,this);
    control.setDisplaySize(176,144);
    int width = control.getSourceWidth();
    int height = control.getSourceHeight();
    status2 = "Before: SW=" + width + "-SH=" + height + "-DW=" + control.getDisplayWidth() + "-DH=" + control.getDisplayHeight();
    }
    
    player.start();
    }
    catch(Exception e) {
    Alert erro = new Alert("Erro",e.getMessage(),null,AlertType.ERROR);
    Display.getDisplay(midlet).setCurrent(erro);
    }
    }
    
    public void stop() {
    if(player != null) {
    player.deallocate();
    player.close();
    }
    }
    
    public void playerUpdate(Player p, String s, Object o) {
    status = s;
    
    if(p.getState() == Player.STARTED) {
    int width = control.getDisplayWidth();
    int height = control.getDisplayHeight();
    control.setDisplayLocation((getWidth() - width)/2,(getHeight() - height)/2);
    control.setVisible(true);
    status = s + ": DW=" + width + "-DH=" + height + "-SW=" + control.getSourceWidth() + "-SH=" + control.getSourceHeight();
    }
    repaint();
    setTitle(status);
    }
    
    
    }
    The code works perfectly allright in Symbian anna, Symbian Belle, Symbian Belle FP1 phones and I am able to view the live stream video. However, when I run this code in S60 5th edition phone, the code does not work. It does not throw any error but the screen remains black (the video is not displayed). I tried using rtsp links of YouTube videos also. Here also I observed that the code works for Symbian anna, Symbian Belle, Symbian Belle FP1 phones but not for S60 5th edition phones.

    As far as my understanding goes, the MMAPI must support the content type and the protocol in order to show the video. So I wrote a small midlet which displays the content type and protocol supported by MMAPI. I ran the code in S60 5th edition, Symbian anna, Symbian Belle, Symbian Belle FP1 phones. Strangely I observerd that rtsp protocol and 3gpp is supported by S60 5th edition phones also. In this regard I have the following queries.

    1. Even though MMAPI in S60 5th edition supports 3gpp and rtsp, why the rtsp link of YouTube is not working in S60 5th editon but the same code works in Symbian anna, Symbian Belle, Symbian Belle FP1.
    2. I want to provide support for S60 5th edition also. In that case what should I do to make video streaming work in
    S60 5th edition also.

    Kindly help me out.

    thanks and regards,
    krishna.

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: Live video streaming using J2ME

    Hi kumarsai,

    Although the content type might be supported on the S60 5th Edition, progressive playback of 3gpp is first introduced on Symbian^3 according to this.

Similar Threads

  1. Live video streaming in J2ME
    By nyerunkar in forum Mobile Java General
    Replies: 4
    Last Post: 2012-02-08, 08:43
  2. Live video streaming on youtube in J2ME
    By omnia amr in forum Mobile Java General
    Replies: 1
    Last Post: 2012-02-07, 07:33
  3. Live TV(Video) Streaming
    By mahendra_g1 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2010-06-21, 15:14
  4. live video streaming
    By sis1987 in forum Symbian
    Replies: 5
    Last Post: 2008-05-29, 05:24
  5. live video streaming
    By j2me_raj in forum Mobile Java General
    Replies: 0
    Last Post: 2003-09-26, 12:20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×