×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    21

    Is it possible to change part of a song while playing?

    Hi all,

    Is it possible to change part of a song while playing? Indeed, I create a player :

    ....
    InputStream is = getClass().getResourceAsStream(/test.wav);
    player = Manager.createPlayer(is,"audio/x-wav");
    player.start();
    ....

    I would like change part of a song while song is playing. I don't know how to do that.

    Can anyone can help me.

    ould

  2. #2
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,699

    Re: Is it possible to change part of a song while playing?

    hi,

    do you mean: change current time (position)?
    something like
    Code:
    player.stop()
    player.setMediaTime(player.getMediaTime()+100);
    player.start();
    (need to be checked againts JSR-135 docs - posted without looking into details in docs),

    regards,
    Peter

  3. #3
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280

    Re: Is it possible to change part of a song while playing?

    If you want to manipulate the data while the song is playing you could try extending the DataSource and SourceStream classes and creating a player with the DataSource subclass you created.

    shmoove

  4. #4
    Super Contributor
    Join Date
    Feb 2006
    Posts
    689

    Re: Is it possible to change part of a song while playing?

    Hi shmoove,
    Can you please give a detailed view of what you told.A code snipplet will be useful.
    thanks
    Soku

  5. #5
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280

    Re: Is it possible to change part of a song while playing?

    Players get the data they play from classes that implement the SourceStream interface. SourceStreams are managed by a class that extends DataSource. You can check the MMAPI docs for more details on these.

    Here's a thread with a more in-depth explanation.

    Here's an article that talks about creating a custom DataSource to try and implement RTP streams.

    In theory, you could load the sound data into a byte array, and implement a DataSource whose SourceStreams get the data from that byte array. That way you would already have access to the byte array and would be able to manipulate the data while it's playing.

    But (and this is a very important but), I believe on most of the phones out there today, Players always try to get all the data in one go. This is a problem for the people trying to implement streaming this way (as you'll notice they mention in both the thread and the article). I don't know if manipulating the data while it's playing would be a problem too though. I guess it depends on whether the Player implementation makes a copy of the byte array it reads, or plays the byte array the SourceStream.read() method returns directly. You'd have to try it on a real phone to see if it actually works like expected.

    shmoove

    PS: Google has some more links that could be useful.

  6. #6
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,699

    Re: Is it possible to change part of a song while playing?

    hi,

    Java Developers Developers Lib (FN doc) while discussing video playback states:
    Note: In the Series 40 platform and from S60 3rd Edition onwards, when playing some data from a file locator, media will be played directly from the file without loading it to the memory first. This can be useful when playing large media files that already exist in the file system.
    (file locator via jsr-75 obviously)
    not sure if that applies to audio playback,
    thanks,
    regards,
    Peter

Similar Threads

  1. Can I set the player to wait for 5 seconds before playing song?
    By vinnahang in forum Mobile Java General
    Replies: 6
    Last Post: 2012-03-26, 15:28
  2. how can I play the song repeatly and stop playing the song?
    By vinnahang in forum Mobile Java General
    Replies: 5
    Last Post: 2012-03-23, 13:23
  3. amr file not playing full
    By S.S.Sudhakar in forum Symbian
    Replies: 9
    Last Post: 2008-01-17, 11:22
  4. Change stream without stopping the player?
    By cars2003 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2006-02-26, 18:24
  5. problem with extracting part of string :-(
    By chishti.hameed in forum Symbian
    Replies: 1
    Last Post: 2005-06-30, 07:44

Posting Permissions

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