×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    6

    Unhappy Video playback with sound but nothing on Screen

    my application captures video and play it back, it works fine on N95 but in N70 it does not display video on screen, but it playBack the captured 3gp. i can hear the sound, i dont know why is this happenning.

    Would any Body help me.

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: Video playback with sound but nothing on Screen

    Hi,

    are you sure about models? N95 is S60 3rd and N70 is S60 2nd FP3. So As I understand you have backported the application to the older Symbian version?

    Please be more descriptive, when you are explaining you problems - now it is nothing then riddle...

    BR
    STeN

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    6

    Post Re: Video playback with sound but nothing on Screen

    thak you for your advice, this is a simple and common application
    but for better clarification i am giving the snapshot of the full program.
    public class CaptureVideo extends MIDlet
    implements CommandListener,PlayerListener {

    // initialize the player and the canvas
    private CaptureVideoCanvas canvas = null;
    private VideoCanvas playCanvas = null;
    Player capturePlayer = null;
    Player playBackPlayer = null;
    // and the other variables
    private VideoControl playVideoControl = null;
    private Alert alert = null;
    private Command exitCommand = null;
    private Command backCommand = null;
    Display display = null;
    private boolean error = false;
    // the output stream
    ByteArrayOutputStream bos = null;

    public CaptureVideo() {
    // create the display items
    alert = new Alert("Message");
    alert.setTimeout(Alert.FOREVER);
    display = Display.getDisplay(this);
    exitCommand = new Command("Exit", Command.EXIT, 1);
    backCommand = new Command("Back", Command.BACK, 1);
    // create the video capture player
    try {
    capturePlayer = Manager.createPlayer("capture://video");
    capturePlayer.realize();
    // now create the canvas
    canvas = new CaptureVideoCanvas(this);
    canvas.addCommand(exitCommand);
    canvas.setCommandListener(this);
    } catch(Exception e) {
    error(e);
    }
    }

    public void startApp() {

    // if error, return
    if(error) return;

    // start the player
    try {
    capturePlayer.start();
    } catch(Exception e) { error(e); }

    // and set the canvas as the current item on display
    display.setCurrent(canvas);
    }

    public void pauseApp() {
    try {
    if(capturePlayer != null) capturePlayer.stop();
    } catch(Exception e) {}
    }

    public void destroyApp(boolean unconditional) {
    if(capturePlayer != null) capturePlayer.close();
    }

    public void playBack()
    {
    String tempString = "";

    try
    {
    loadPlayer();
    tempString += "createPlayer>>realize";
    // VideoCanvas is a non public class in this file
    playCanvas = null;
    playCanvas = new VideoCanvas(this);

    playCanvas.addCommand(backCommand);
    playCanvas.setCommandListener(this);

    display.setCurrent(playCanvas);
    playBackPlayer.prefetch();
    // and start the player
    playBackPlayer.start();
    tempString += ">>start()";
    }
    catch( Exception ex)
    {
    error(ex);
    }
    }

    public void playerUpdate(Player player, String event, Object eventData)
    {
    if(event.equals(PlayerListener.END_OF_MEDIA))
    {
    try
    {
    if(player != null)
    playBackPlayer.close();
    capturePlayer.start();
    display.setCurrent(canvas);
    }catch(Exception e)
    {
    error(e);
    }

    playBackPlayer = null;

    System.gc();
    }
    }

    public void commandAction(Command cmd, Displayable disp) {
    if(cmd == exitCommand) {
    destroyApp(true);
    notifyDestroyed();
    }
    else if(cmd == backCommand)
    {
    try
    {
    playBackPlayer.stop();
    if(playBackPlayer != null)
    playBackPlayer.close();
    capturePlayer.start();
    display.setCurrent(canvas);
    }catch(Exception e)
    {
    error(e);
    }

    playBackPlayer = null;
    playVideoControl = null;
    System.gc();
    }
    }
    // general purpose error method, displays on screen as well to output
    void error(Exception e) {
    alert.setString(e.getMessage());
    alert.setTitle("Error");
    display.setCurrent(alert);
    error = true;
    }
    private void loadPlayer() throws Exception {
    // loads the Player on this MP4 file.
    // feature
    playBackPlayer = Manager.createPlayer((InputStream)new ByteArrayInputStream(bos.toByteArray()), "video/3gpp");
    playBackPlayer.realize();
    playBackPlayer.addPlayerListener(this);
    }
    }

    // the canvas that perform capturing
    class CaptureVideoCanvas extends Canvas {
    // the base midlet
    CaptureVideo midlet = null;
    String text = "";
    // the video control
    private VideoControl videoControl = null;
    // the record control
    private RecordControl rControl = null;
    // flag to keep track of when recording is started
    private boolean recording = false;
    public CaptureVideoCanvas(CaptureVideo midlet) throws Exception {
    this.midlet = midlet;
    // initialize the video control
    videoControl =
    (VideoControl)midlet.capturePlayer.getControl(
    "javax.microedition.media.control.VideoControl");

    // if not present, throw error
    if(videoControl == null)
    throw new Exception("No Video Control for capturing!");
    // init display mode to use direct video and this canvas
    videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
    try { // try and set to full screen
    videoControl.setDisplayFullScreen(true);
    } catch(MediaException me) {
    // but some devices may not support full screen mode
    videoControl.setDisplayLocation(5, 5);
    try {
    videoControl.setDisplaySize(getWidth() - 10, getHeight() - 10);
    } catch(Exception e) {}
    repaint();
    }
    // and make the video control visible
    videoControl.setVisible(true);
    }

    public void keyPressed(int keyCode) {
    // see what game action key the user has pressed
    int key = getGameAction(keyCode);
    // if the camera is recording at the moment, then just return
    // unless the key code is DOWN to stop recording
    if(recording && (key != DOWN)) return;

    // if fire, take a snapshot
    if(key == FIRE) {

    try {
    // use the control to take the picture, using the default encoding
    byte[] imageArray = videoControl.getSnapshot(null);

    // create an image using the LCDUI Image class
    Image image = Image.createImage(imageArray, 0, imageArray.length);

    // make this image a part of an Alert
    Alert imageAlert =
    new Alert("Snapshot", "" + imageArray.length/1024, image, AlertType.INFO);

    // show this alert for 5 seconds
    imageAlert.setTimeout(5000);

    // and show this alert
    midlet.display.setCurrent(imageAlert);

    } catch(Exception e) {
    midlet.error(e);
    }
    } else if(key == UP) {
    // start recording
    try {
    // grab a record control
    rControl = (RecordControl)midlet.capturePlayer.getControl(
    "javax.microedition.media.control.RecordControl");
    // if not found, throw exception
    if(rControl == null) throw new Exception("No RecordControl found!");
    // create a ByteArrayOutputStream to store this recorded data in
    midlet.bos = new ByteArrayOutputStream();
    // set up the stream
    rControl.setRecordStream(midlet.bos);
    // and start recording - no need to start the underlying player
    // as it is already started
    rControl.startRecord();
    // set flag
    recording = true;
    } catch(Exception e) {
    midlet.error(e);
    }
    } else if(key == DOWN) {

    try {

    rControl.stopRecord();
    rControl.commit();

    recording = false;

    int size = midlet.bos.size();
    int counter = 0;
    Alert infoAlert =
    new Alert("Capture ", "Capture completed ... video size : " + size ,null, AlertType.INFO);
    infoAlert.setTimeout(Alert.FOREVER);
    midlet.display.setCurrent(infoAlert);

    } catch(Exception e) {
    midlet.error(e);
    }
    }
    else if(key == RIGHT) {
    text = "FREE" +"("+ Runtime.getRuntime().freeMemory()/1024 + ")"+ "[" +Runtime.getRuntime().totalMemory()/1024 + "]";
    Alert imageAlert =
    new Alert("Memory", text,null, AlertType.INFO);

    imageAlert.setTimeout(Alert.FOREVER);

    // and show this alert
    midlet.display.setCurrent(imageAlert);
    }
    else if(key == LEFT)
    {
    //System.gc();
    try {
    if(midlet.capturePlayer != null)
    midlet.capturePlayer.stop();
    midlet.capturePlayer.close();
    midlet.capturePlayer = null;
    videoControl = null;
    Thread.sleep(5000);
    } catch(Exception e) {}
    midlet.playBack();
    }
    }

    public void paint(Graphics g) {

    }
    }

    // VideoCanvas that is the container for the video
    class VideoCanvas extends Canvas {
    private VideoControl videoControl = null;
    private CaptureVideo midlet;
    public VideoCanvas(CaptureVideo midlet) throws Exception {

    this.midlet = midlet;
    // initialize the video control
    videoControl =
    (VideoControl)midlet.playBackPlayer.getControl(
    "javax.microedition.media.control.VideoControl");
    // if not present, throw error
    if(videoControl == null)
    throw new Exception("No Video Control for capturing!");
    // init display mode to use direct video and this canvas
    videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
    videoControl.setDisplayFullScreen(true);

    // and make the video control visible
    videoControl.setVisible(true);
    }
    public void paint(Graphics g) {

    }
    }

  4. #4
    Registered User
    Join Date
    Nov 2007
    Posts
    6

    Question Re: Video playback with sound but nothing on Screen

    I have written another application which uses a single player object to capture and playback. when capture is done it is closed then new one is open for the playback of the captured video and then playback is end and it is close.

    THE PROBLEM HERE IS THAT IT CRUSHES AFTER 4/5 TIMES CAPTURE AND PLAYBACK. I dont know why is this happening!!!

    //
    The code which i could not able to run, there was a point to notice ,the two players. Whenever the playback player is running the capture player is open, it is just stopped then. Is this a problem ? I think no coz the sound is ok, the only problem is with the video image, it is not seen then.

    There might be another problem which one of my friend told me, to create multiple players in short times is dangerous and it may cause problem.

    So friend CHEERS and think if you can HELP me.

  5. #5
    Registered User
    Join Date
    Nov 2007
    Posts
    6

    Re: Video playback with sound but nothing on Screen

    HI STENLIK,

    I am sure about the model one is N90 successful, N70 is a failure.

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    9

    Re: Video playback with sound but nothing on Screen

    hi abdullah,
    possibly can be an out of memory exception.
    You can install taskman application (http://www.smartphoneware.com/taskma...n-download.php)
    and see how much memory you have.
    I hope this helps,
    Eva

Similar Threads

  1. N95 problem with local video file playback
    By dermicha in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2007-07-23, 17:11
  2. Black screen when playing Video on Nokia 6680
    By cbazza@poliplus.com in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2007-01-26, 17:24
  3. Video Playback: Not enough memory?
    By kingnebu in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-07-07, 22:59
  4. Problem with Sound class getState()
    By creepymo in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-06-20, 18:43
  5. Play video without sound
    By shsf in forum Symbian
    Replies: 0
    Last Post: 2004-08-17, 10:17

Posting Permissions

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