×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2009
    Location
    ભારત->ગુજરાત->ભાવનગર
    Posts
    279

    Question Changing Audio source - unable to play audio with onStopped method

    Hi Friends,
    I am using QML Audio element.
    Code:
    Audio {
                     id: playMusic
                     
                     onStopped: 
                      {
                         playMusic.play()
                     }
    
    
                  }
    I am using two .wav files and toggling from one to second wav file and vice versa shown below.

    Code:
    Button {
                        id: stopButton
                        x: 424
                        y: 2
                        width: 67
                        height: 36
                        anchors { right: parent.right; verticalCenter: parent.verticalCenter }
                        text: "Next"
    
                        onClicked: {
    
                                 Logic.a+=1
                                 if(Logic.a==Logic.hex1.length)
                                 Logic.a=0
    
    
                        playMusic.source = Logic.pic()+".wav"
                        console.log(playMusic.source)
    
                        playMusic.play()
    
    
    
                        }
    when this code is executed first file is played very well but when pressing "Next", the second file unable to play...i have check in console the second file is loaded but unable to play.
    When i remove onStopped method from the Audio element it works as expected,but i want to repeat the playing so when a music file plays fully and get stopped the onStopped method is called and it start playing again...

    Any other alternate way to play repeatedly audio file...?????
    Regards
    Viral Parmar

  2. #2
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Changing Audio source - unable to play audio with onStopped method

    What about using SoundEffect element? it has a loop property which you can find useful.
    If you are interested in it you can read more at http://doc.qt.nokia.com/qtmobility-1...t.html#details

  3. #3
    Registered User
    Join Date
    Jan 2009
    Location
    ભારત->ગુજરાત->ભાવનગર
    Posts
    279

    Re: Changing Audio source - unable to play audio with onStopped method

    Quote Originally Posted by gnuton View Post
    What about using SoundEffect element? it has a loop property which you can find useful.
    If you are interested in it you can read more at http://doc.qt.nokia.com/qtmobility-1...t.html#details
    well i was also thinking the same....but before using sound element i thought of using Audio, anyways will try and let you know..
    thanks..
    Regards
    Viral Parmar

  4. #4
    Registered User
    Join Date
    Jan 2009
    Location
    ભારત->ગુજરાત->ભાવનગર
    Posts
    279

    Thumbs up Re: Changing Audio source - unable to play audio with onStopped method [Solved]

    hey thanks problem is solved by using SoundEffect.
    Code:
     SoundEffect {
                     id: playMusic
                     loops: SoundEffect.Infinite
    
    }

    thanks...
    Regards
    Viral Parmar

Similar Threads

  1. How to play audio to uplink with VoIP Audio Services
    By paipeng in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2011-12-08, 06:50
  2. Unable to Play Audio/ Video (Qt)
    By somnathbanik in forum Qt
    Replies: 2
    Last Post: 2010-10-13, 08:01
  3. Replies: 2
    Last Post: 2010-07-22, 16:20
  4. Unable to play audio files
    By ra.ravi.rav in forum Symbian
    Replies: 9
    Last Post: 2008-09-27, 07:56
  5. How to play an amr audio with Audio Proxy Service?!
    By paipeng in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2008-05-22, 16:15

Posting Permissions

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