Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-5953

'startPlayingAudio' causes audio file to be restarted; unable to resume from paused position

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 3.3.0
    • None
    • cordova-plugin-media
    • iOS

    Description

      OVERVIEW
      The Media plugin uses 'startPlayingAudio' when Media#play() is called (https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media.git;a=blob;f=www/Media.js;h=083af3623a56fded9fd25505a94d19bd901c5e6a;hb=HEAD#l75).

      The comment states that this will "play or resume" audio but every time, the audio starts from the beginning.

      I've only tested on iOS and my cause/solultions only cover this. I'm not familiar enough with the other platforms right now to make a judgement.

      CAUSE
      CDVAudioFile is initialised from scratched each time startPlayingAudio is called, rather than reusing the current playing instance: https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media.git;a=blob;f=src/ios/CDVSound.m;h=14b2fc24387cbf91e8e1aad15c3717af63b26ecd;hb=HEAD#l297

      POSSIBLE SOLUTIONS
      1. Store the current playing instance and reuse the resource path is unchanged
      2. Add a 'resume' method to use instead of using play

      I'm happy to look into either of these but I'd like confirmation of my assessment of the problem and some kind of consensus on the solution.

      WORKAROUNDS
      I'm now attempting to store the audio position at the time of pausing then doing a seek after play to put the audio in the correct place via the JS - not ideal.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sbartholomew Stephen Bartholomew
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: