×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    19

    False implementation of "playerListner" ???

    Hi all,

    Take a look at following code snippet:
    Code:
    Player soundPlayer = Soundplayer.getInstance(String fileNmae) ; 
    //This creates a player to play a simple midi file. 
    soundpayer.registerListner(this) ;
    ....
    ....
    
    public void playerUpdated(Player player, String event, Object eventData){
               if (event == PlayerListner.END_OF_MEDIA){
                       discardSoundPlayer() ;
                       // This stops and deallocates soundPlayer
                }
             ................
             ..............
    }
    Now the problem I am facing is, the "END_OF_MEDIA" event is not notified properly. I am playing a file of length 1 sec, but it takes about 15-20 sec to trigger the "END_OF_MEDIA", after the player has been started. So when I try to access a camera immediately after the sound is heard, it throws a MediaException: PrefetchError.... (Since the SoundPlayer is not deallocated yet....). Any guesses???

    I have encountered this problem in Nokia 6500s/c , Nokia 6131, Nokia 6300. I thought upgrading the firmware will solve my problem, but it didn't help at all.

    Is it a S40's issue ??? Is there any work arround ??

    Any suggestion is welcomed.

    Thanks & regards,
    Bharat Patel.

  2. #2
    Nokia Developer Champion
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,192

    Re: False implementation of "playerListner" ???

    The code contains a few typos, and and some references of to methods not included in the code snippet. Is this a real excerpt of working (well, in your case a non-working) code?

    Does the code work properly on any devices? If yes, which ones?

    Hartti

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    19

    Re: False implementation of "playerListner" ???

    Hi,
    thanks for the reply. I have written such abstruse code intentionally , just to reduce mess. The actual code is really confusing. Let me try to make it more clear (please also take a look at previous code snippet)...

    "SoundPlayer" is my utility class, which I use to play a sound. It also implements the "PlayerListner" and overrides the "playerUpdated" method to perform some operation depending upon the event passed to it.

    "SoundPlayer.getInstance(String fileName)" is a static method of SoundPlayer, which creates a player (on each method call), get DataSource depending upon passed argument-fileNmae.. and do the realize() & prefetch () .. standard method calls for "Player".

    discardPlayer()
    is used to stop and deallocate the created SoundPlayer whenever the "END_OF_MEDIA" event is posted.

    I hope it's clear so far... Now my problem is that, the "END_OF_MEDIA" event is not posted on time. As I have mentioned earlier, it takes 15-20 sec to post the event (I took difference between timestamps of events "END_OF_MEDIA" and "STARTED"), though I am playing a MIDI file of length 1 sec.

    For devices of Nokia S60, Sony Ericsson this is working fine. I only encounter such problem for Nokia S40 devices. Due to this when I try to access a camera immediately after the sound is heard, it throws a MediaException: PrefetchError.You cannot prefetch while other players are playing. (Since the "END_OF_MEDIA" is not posted and the SoundPlayer is not deallocated yet....)

    I hope I have made it all clear.

    Any of you people have encountered such problem ??

    Regards,
    Bharat.

  4. #4
    Registered User
    Join Date
    Jul 2007
    Location
    Paris, France
    Posts
    41

    Re: False implementation of "playerListner" ???

    Any news on this ?

    Quote Originally Posted by bharatpatel85 View Post
    Hi,
    Now my problem is that, the "END_OF_MEDIA" event is not posted on time. As I have mentioned earlier, it takes 15-20 sec to post the event (I took difference between timestamps of events "END_OF_MEDIA" and "STARTED"), though I am playing a MIDI file of length 1 sec.

    For devices of Nokia S60, Sony Ericsson this is working fine. I only encounter such problem for Nokia S40 devices. Due to this when I try to access a camera immediately after the sound is heard, it throws a MediaException: PrefetchError.You cannot prefetch while other players are playing. (Since the "END_OF_MEDIA" is not posted and the SoundPlayer is not deallocated yet....)

    Any of you people have encountered such problem ??
    I think I have the same problem on a Nokia 6212 (S40) .
    Not all phones have the problem, though (maybe 10 out of 50), and those that do only have it sometimes.

    Bharat, did you find a solution ?
    Thanks

Similar Threads

  1. Bug (?) in JSR-82 implementation
    By astfgl in forum Tools and SDK Feedback (Closed)
    Replies: 3
    Last Post: 2008-06-25, 13:52
  2. When does Nokia go to the Symbian SCOMO Implementation ?
    By emcneil@bitfone.com in forum OMA DM/DS/CP
    Replies: 0
    Last Post: 2008-05-07, 00:38
  3. JSR 179 Implementation
    By gruntzd in forum Mobile Java General
    Replies: 1
    Last Post: 2007-02-26, 07:31
  4. Replies: 1
    Last Post: 2003-04-18, 04:30

Posting Permissions

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