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

Can't start media streaming on Android 6.0

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • cordova-plugin-media
    • None

    Description

      We are trying to play online radio stations with Cordova, for example these stations:
      http://www.hendrikjansen.nl/henk/streaming.html

      But when we try the current released version 2.3.0 or the current dev 2.3.1-dev, both give the same adb logcat output:

      05-24 15:22:08.936 27095 27176 E MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
      05-24 15:22:08.936 27095 27176 E MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
      05-24 15:22:08.940   798  3345 I MediaFocusControl:  AudioFocus  requestAudioFocus() from android.media.AudioManager@fd128bforg.apache.cordova.media.AudioHandler$1@932bb8c req=1flags=0x0
      05-24 15:22:08.953 27095 27415 D MediaHTTPConnection: filterOutInternalHeaders: key=User-Agent, val= stagefright/1.2 (Linux;Android 6.0.1)
      05-24 15:22:08.954 27095 27810 D MediaHTTPConnection: proxy null port 0
      05-24 15:22:13.341   258 30530 I FFmpegExtractor: android-source:0xb5f4f8c0
      05-24 15:22:13.343   258 30530 E FFMPEG  : FFSource getSize failed
      05-24 15:22:13.343   258 30530 E FFMPEG  : FFSource getSize failed
      05-24 15:22:13.343   258 30530 E FFMPEG  : FFSource getSize failed
      05-24 15:22:13.343   258 30530 I FFMPEG  : [mp3 @ 0xae696e00] Skipping 0 bytes of junk at 0.
      05-24 15:22:13.343   258 30530 D FFmpegExtractor: suppoted codec(mp3) by official Stagefright
      05-24 15:22:13.343   258 30530 D FFmpegExtractor: ffmpeg detected media content as 'audio/mpeg' with confidence 0.08
      05-24 15:22:13.344   258 30529 D NuPlayerDriver: notifyListener_l(0xae76c0e0), (1, 0, 0)
      05-24 15:22:13.345 27095 27176 D MediaPlayer: setSubtitleAnchor in MediaPlayer
      05-24 15:22:13.347   258  2659 E MediaPlayerService: getDuration returned -2147483648
      05-24 15:22:13.347 27095 27176 W MediaPlayer: Stream has no duration and is therefore not seekable.
      05-24 15:22:13.347 27095 27176 E MediaPlayer: error (-2147483648, 0)
      05-24 15:22:13.347 27095 27176 D AudioPlayer: Send a onStatus update for the new seek
      05-24 15:22:13.348 27095 27176 E MediaPlayer: start called in state 0
      05-24 15:22:13.348 27095 27176 E MediaPlayer: error (-38, 0)
      05-24 15:22:13.348 27095 27176 E MediaPlayer: Attempt to call getDuration without a valid mediaplayer
      05-24 15:22:13.348 27095 27176 E MediaPlayer: error (-38, 0)
      05-24 15:22:13.348 27095 27176 E MediaPlayer: Error (-2147483648,0)
      05-24 15:22:13.348 27095 27176 D AudioPlayer: on completion is calling stopped
      05-24 15:22:13.349 27095 27176 E MediaPlayer: Error (-38,0)
      05-24 15:22:13.349 27095 27176 D AudioPlayer: on completion is calling stopped
      05-24 15:22:13.349 27095 27176 E MediaPlayer: Error (-38,0)
      05-24 15:22:13.349 27095 27176 D AudioPlayer: on completion is calling stopped
      

      If I comment out the lines https://github.com/apache/cordova-plugin-media/blob/master/src/android/AudioPlayer.java#L435 (this.seekToPlaying(this.seekOnPrepared);) and https://github.com/apache/cordova-plugin-media/blob/master/src/android/AudioPlayer.java#L445 (this.duration = getDurationInSeconds();). It does start the stream, but as soon as I receive a notification from a different app (for example a new WhatApp message) the MediaPlayer crashes.

      Attachments

        Issue Links

          Activity

            Tests failing on iOS, WP: CB-11458, CB-11429

            shazron Shazron Abdullah added a comment - Tests failing on iOS, WP: CB-11458 , CB-11429

            Pushed fix to master.

            macdonst Simon MacDonald added a comment - Pushed fix to master.

            This certainly fixes it for me.

            devgeeks Tommy-Carlos Williams added a comment - This certainly fixes it for me.

            Commit e58211271c1b6b451c29e4c585d965870ceb8d48 in cordova-plugin-media's branch refs/heads/master from macdonst
            [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media.git;h=e582112 ]

            CB-11313: Can't start media streaming on Android 6.0 (test case)

            jira-bot ASF subversion and git services added a comment - Commit e58211271c1b6b451c29e4c585d965870ceb8d48 in cordova-plugin-media's branch refs/heads/master from macdonst [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media.git;h=e582112 ] CB-11313 : Can't start media streaming on Android 6.0 (test case)

            Commit e8d41da684e25f880978ed3485198d4dd2613e96 in cordova-plugin-media's branch refs/heads/master from macdonst
            [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media.git;h=e8d41da ]

            CB-11313: Can't start media streaming on Android 6.0

            jira-bot ASF subversion and git services added a comment - Commit e8d41da684e25f880978ed3485198d4dd2613e96 in cordova-plugin-media's branch refs/heads/master from macdonst [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media.git;h=e8d41da ] CB-11313 : Can't start media streaming on Android 6.0

            One thing I might suggest, perhaps the media plugin tests need to include tests against an infinite stream like a radio station shoutcast.

            devgeeks Tommy-Carlos Williams added a comment - One thing I might suggest, perhaps the media plugin tests need to include tests against an infinite stream like a radio station shoutcast.
            devgeeks Tommy-Carlos Williams added a comment - - edited

            OK. Using the simplest possible repro app, confirmed that commenting out this.seekToPlaying(this.seekOnPrepared); at https://github.com/apache/cordova-plugin-media/blob/master/src/android/AudioPlayer.java#L435 will allow the stream to play on Android 6.x

            I have no idea what the issue is, but suspect it has to do with the errors relating to seeking and duration:

            05-24 15:22:13.347 27095 27176 W MediaPlayer: Stream has no duration and is therefore not seekable.

            devgeeks Tommy-Carlos Williams added a comment - - edited OK. Using the simplest possible repro app, confirmed that commenting out this.seekToPlaying(this.seekOnPrepared); at https://github.com/apache/cordova-plugin-media/blob/master/src/android/AudioPlayer.java#L435 will allow the stream to play on Android 6.x I have no idea what the issue is, but suspect it has to do with the errors relating to seeking and duration: 05-24 15:22:13.347 27095 27176 W MediaPlayer: Stream has no duration and is therefore not seekable.
            devgeeks Tommy-Carlos Williams added a comment - - edited

            I am coming up against something very similar. Also failing on Android 6. I am trying to work out what's going on and I'll post more logs etc as soon as I can.

            I can also get it to play (kinda) by commenting out the this.seekToPlaying(this.seekOnPrepared);

            devgeeks Tommy-Carlos Williams added a comment - - edited I am coming up against something very similar. Also failing on Android 6. I am trying to work out what's going on and I'll post more logs etc as soon as I can. I can also get it to play (kinda) by commenting out the this.seekToPlaying(this.seekOnPrepared);

            People

              macdonst Simon MacDonald
              markdark Mark Veenstra
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: