Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor rj12info's Avatar
    Join Date
    Jan 2009
    Location
    Bangalore
    Posts
    52
    Hi All
    I am using this code for video playback
    And I want my app to start play videos > 2MB without much lag or delay. I am using this code.

    void initPlayer()
    {

    try {
    try {
    player = Manager.createPlayer(filUrl); /******If no file-->got to catch get it from jar**************/
    player.addPlayerListener(this);
    player.prefetch();
    player.realize();
    }catch(Exception e) {
    InputStream is = getClass().getResourceAsStream("/Videos/britney.mp4");
    player = Manager.createPlayer(is, "video/mp4");
    player.addPlayerListener(this);
    player.prefetch();
    player.realize();
    }
    VideoControl videoControl = (VideoControl) (player.getControl("VideoControl"));

    if (videoControl == null) {
    midlet.alertError("VideoControl not supported");
    }
    else {
    videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,
    this);
    videoControl.setVisible(true);
    }
    videoControl.setDisplayLocation(20,150);
    videoControl.setDisplaySize(320, 320);
    initDone = true;
    }
    catch (IOException ioe) {
    discardPlayer();
    midlet.alertError("IOException: " + ioe.getMessage());
    }
    catch (MediaException me) {
    discardPlayer();
    midlet.alertError("MediaException: " + me.getMessage());
    }
    catch (SecurityException se) {
    discardPlayer();
    midlet.alertError("SecurityException: " + se.getMessage());
    }
    catch (Exception ex) {
    discardPlayer();
    midlet.alertError("Exception: " + ex.getMessage());
    }

    }
    Can anybody please guide my app through to play videos with max 10 seconds delay for buffering.


    http://www.youtube.com/watch?v=coV06ChYWJo

  2. #2
    Nokia Developer Champion im2amit's Avatar
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    2,903
    This may be happening because of low heap memory for j2me for 3MB file........ generally its around 2MB of heap available to j2me at the start.
    Try reading the URL in chunks of 512kb each in a background thread and pass the stream to the player.
    thanks,
    ~Amitabh
    (Poster of the Month -Dec'12)
    Follow me on my blog for Innovative Mobile Apps

  3. #3
    Regular Contributor rj12info's Avatar
    Join Date
    Jan 2009
    Location
    Bangalore
    Posts
    52
    Hi Amit

    Thanks for the help. With that I like to know how I should go about buffering the video in chunks .The only answer I have is to use ByteArray inputstream and feed to player manger. But this has to be done at the cost of using a thread?

    Please let me know abt this


    Thanks
    rj12info

Similar Threads

  1. S60 5th edition applications in 3rd edition phones
    By radhamanogar in forum Symbian C++
    Replies: 4
    Last Post: 2012-08-08, 06:47
  2. Replies: 19
    Last Post: 2010-10-19, 11:30
  3. Replies: 1
    Last Post: 2010-05-01, 20:00
  4. play video on S60 5th edition
    By berry09 in forum Symbian Web Runtime
    Replies: 5
    Last Post: 2010-02-04, 20:17
  5. Cannot play mp3 file in S60 5th edition emualtor
    By trandinhduy in forum Audio
    Replies: 7
    Last Post: 2009-09-14, 09:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved