×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    37

    [moved] multiple players on N95

    Does the N95 phone suppport multiple players?
    I have an application with two players (one is playing while the other is initialised)
    When I realize the second player, I get an error:
    Symbian OS Error: -45

    And the first player stops playing...

    The same program runned on a Nokia 6500c gives no problems.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,740

    Re: multiple players on N95

    Negative numbers are here: http://wiki.forum.nokia.com/index.php/Error_codes
    Exactly what kind of players do you mean?

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    37

    Re: [moved] multiple players on N95

    Code:
    private void prefetchNextVideo() {
            int prefetchIndex;
            if (firstChunk) {
                prefetchIndex = playingIndex;
            } else {
                prefetchIndex = playingIndex + 1 % player.length;
            }
            boolean hasNext = provider.hasNext();
            if (hasNext) {
                while (!provider.nextReady()) {
                    try {
                        Thread.sleep(200);
                    } catch (InterruptedException ex) {
                        ex.printStackTrace();
                    }
                }
                try {
                    player[prefetchIndex] = Manager.createPlayer(provider.nextVideoUrl());
                    if (player[prefetchIndex] == null) {
                        throw new MediaException("Could not create a player");
                    }
                    //PlayerListener that tries to play the next part of the video if present
                    player[prefetchIndex].addPlayerListener(new ChunkPlayerListener());
                realize(prefetchIndex);
                } catch (MediaException e) {
                } catch (IOException ie) {
                }
            } else {
                nextReady = false;
            }
        }
    
    
    
        /**
         * Is called to start playing and when END_OF_MEDIA has occurred
         */
        private void nextVideo() throws MediaException, IOException {
            playingIndex = playingIndex + 1 % player.length;
            try {
                if (firstChunk) {
                    loadControl.startLoading();
                    prefetchNextVideo(); //Only for the first part
                }
                while (player[playingIndex] == null) {
                    LOGGER.info("nullplayer");
                }
                //Create the display component and add it to the videoContainer
                mc = new MediaComponent(player[playingIndex]);
                videoContainer.removeAll();
                videoContainer.addComponent(mc);
                //Display the video
                videoControl[playingIndex].setVisible(true);
                mc.setVisible(true);
                if (firstChunk) {
                    firstChunk = false;
                    loadControl.reportReadyToPlay();
                } else {
                    mc.start();
                }
                prefetchNextVideo();
            } catch (IllegalStateException ie) {
            } catch (Exception e) {
            } finally {
                loadControl.stopLoading();
            }
        }
    
    The ChunkPlayerListener calls nextVideo() when an END_OF_MEDIA event occurs

  4. #4
    Registered User
    Join Date
    Dec 2008
    Posts
    37

    Re: [moved] multiple players on N95

    Code:
    I have written a testform that reproduces the error:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package com.vodtec.mobile.lwuit;
    
    import com.sun.lwuit.Command;
    import com.sun.lwuit.Form;
    import com.sun.lwuit.MediaComponent;
    import com.sun.lwuit.events.ActionEvent;
    import com.sun.lwuit.layouts.BorderLayout;
    import com.vodtec.mobile.media.LoggingPlayerListener;
    import java.io.IOException;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    import javax.microedition.media.control.VideoControl;
    import javax.microedition.media.control.VolumeControl;
    
    /**
     *
     * @author jdesmedt
     */
    public class MultiplePlayerForm extends Form {
    
        
    MediaComponent mc0;
    MediaComponent mc1;
    Player[] players;
        public MultiplePlayerForm(String url1, String url2, final Form parent) {
            super("VideoTest");
            Command back = new Command("Back") {
    
                public void actionPerformed(ActionEvent arg0) {
                    parent.show();
                    players[0].close();
                    players[1].close();
                    mc0.stop();
                    mc1.stop();
                }
            };
            addCommand(back);
            setBackCommand(back);
            try {
                players = new Player[2];
                players[0] = Manager.createPlayer(url1);
                players[1] = Manager.createPlayer(url2);
                players[0].realize();
                players[0].prefetch();
                players[1].realize();
                players[1].prefetch();
                
                players[0].addPlayerListener(new LoggingPlayerListener("player 1"));
                players[1].addPlayerListener(new LoggingPlayerListener("player 2"));
                
                mc0 = new MediaComponent(players[0]);
                mc1 = new MediaComponent(players[1]);
    
                setLayout(new BorderLayout());
                addComponent(BorderLayout.WEST,mc0);
                addComponent(BorderLayout.EAST,mc1);
    
    
                mc0.setVisible(true);
                mc1.setVisible(true);
                
                VolumeControl voc = (VolumeControl) players[0].getControl("VolumeControl");
                voc.setMute(true);
                voc =  (VolumeControl) players[1].getControl("VolumeControl");
                voc.setMute(true);
                
                VideoControl vic = (VideoControl) players[0].getControl("VideoControl");
                vic.setDisplayLocation(0, 0);
                vic = (VideoControl) players[1].getControl("VideoControl");
                vic.setDisplayLocation(0, 100);
    
                mc0.start();
                mc1.start();
    
            } catch (Exception e) {
                e.printStackTrace();
            }
    
        }
    }
    The LoggingPlayerListener logs the events that occur.

    When I execute this code on a Nokia N95 I get: Symbian OS error: -45 (What does this mean?)
    When I execute this code on a Nokia 6500c I get: deviceUnavailable on the first player

  5. #5
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: [moved] multiple players on N95

    Hi,
    Just read the codes given by the wizard_hu_,
    the same code you are asking is stand for -

    The completion status when an outstanding client/server message is completed because a shared session has been closed.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  6. #6
    Registered User
    Join Date
    Dec 2008
    Posts
    37

    Re: [moved] multiple players on N95

    I have read the code, but I don't know what it means: the player plays local files and therefore does not connect to a server... How can there be a client/server problem??

  7. #7
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: [moved] multiple players on N95

    Hi,
    I guess it is due to expiring the session has been closed or expired,
    just google it
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  8. #8
    Registered User
    Join Date
    Dec 2008
    Posts
    37

    Re: [moved] multiple players on N95

    I have read on several forums and sites that Nokia supports multiple players.
    Can anybody explain why my simple MultiplePlayerForm doesn't work??

    Thanks

  9. #9
    Registered User
    Join Date
    Dec 2008
    Posts
    37

    Re: [moved] multiple players on N95

    Nobody ???

  10. #10
    Registered User
    Join Date
    Dec 2004
    Posts
    369

    Re: [moved] multiple players on N95

    Hi,
    i can confirm to you that N95 does support multiple players being initialized and even prefetch for some.
    the thing u are describing can be a result of a network operator enforcing types of restrictios on phones.

    for instance ALL sprint phones can only have 1 player in open state (doesnt matter if its in realize state or prefetch or started) if a second player is created the first player goes to close state at once....

    so... which operator do u use? is the phone branded to that operator?


    BR
    shai

  11. #11
    Registered User
    Join Date
    Dec 2008
    Posts
    37

    Re: [moved] multiple players on N95

    The phone is not branded. It's a phone for test-purposes and doesn't even have a SIM-card inserted.
    Is progressive download supported on the N95? (If this is supported I don't need to have multiple players.)

    Thanks

Similar Threads

  1. [Moved] N95 8-GB Volume control not working
    By ruchirvasavada in forum Audio
    Replies: 2
    Last Post: 2008-11-28, 11:17
  2. [moved] problem with my s60 3rd - n95
    By Scooty_trance in forum General Development Questions
    Replies: 1
    Last Post: 2008-08-02, 17:14
  3. How to mark multiple messages at Nokia N95 outbox
    By Curtis1993 in forum General Development Questions
    Replies: 9
    Last Post: 2008-07-14, 08:37
  4. multiple players
    By prakash_chowdary in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-05-26, 14: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
  •  
×