You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Shawn Makinson (JIRA)" <ji...@apache.org> on 2017/06/05 21:31:04 UTC

[jira] [Created] (CB-12885) iOS - No sound after pause Media plugin ( sometimes )

Shawn Makinson created CB-12885:
-----------------------------------

             Summary: iOS - No sound after pause Media plugin ( sometimes )
                 Key: CB-12885
                 URL: https://issues.apache.org/jira/browse/CB-12885
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-media
    Affects Versions: cordova@7.0.0
         Environment: iOS
            Reporter: Shawn Makinson


Media player will sometimes resume audio immediately. Seemingly randomly it  will then have a delay after pause() then play() calls. The length of the delay seems to increase. Sometimes it goes straight to no audio sound at all. There is no indication from the error or status callback. The status indicates running. If I create a new Media instance it plays again.

The stream is an infinite stream ( duration -1 )

In searching the web I came across this discussion: https://github.com/delannoyk/AudioPlayer/issues/21

which makes it sound like it could possibly be an issue on Apples side. What do you all think? For now I think I may resort to a new instance every time a pause/play is done since I cant seem to find any consistency in timing or any errors to react to.

The code looks like:
{code}

export default class MediaPlayer {
  constructor (station) {
    this.station = station
    this.status = window.Media.MEDIA_NONE
    this.audioPlayer = new window.Media(this.station.streamSource.file, () => {
      console.log('========> cordova audio: Success')
    }, (err) => {
      console.log('========> cordova audio: OnLoadError', err)
    }, (status) => {
      console.log('========> cordova audio: OnStatus', status)
      this.status = status
    })
  }

  get playing () {
    if (this.status === window.Media.MEDIA_RUNNING) {
      return true
    }
    return false
  }

  play () {
    if (!this.playing && this.audioPlayer) {
      this.audioPlayer.play()
    }
  }

  pause () {
    if (this.audioPlayer) {
      this.audioPlayer.pause()
    }
  }

  togglePause () {
    if (this.playing) {
      this.pause()
    }
    else {
      this.play()
    }
  }

  unload () {
    this.audioPlayer.release()
  }
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org