0

I'm trying to play an audio stream from a m3u8 url using Android's MediaPlayer.

From the information my client gave me, the stream is AAC encoded stream, 56 kbps, 44.1 KhZ, HE v1 within a HLS container.

According to the information given here, the m3u8 format is accepted:

Applications can now pass an M3U playlist URL to the media framework to begin an HTTP Live streaming session. The media framework supports most of the HTTP Live streaming specification, including adaptive bit rate.

And according to the doc on supported media formats, the provided AAC format is accepted too.

The stream seems to play properly on Android 4.4.4, but many devices I've tried with a lower version return the error (1, -1010), i.e. MEDIA_ERROR_UNSUPPORTED.

What am I missing?

stream file content (mydomain.com/mystreamaudio.m3u8)

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:75514
#EXTINF:10.00,
mystreamaudio/Seg_111014_170037_75/mystream_111014_170037_75514.aac
#EXTINF:10.00,
mystreamaudio/Seg_111014_170037_75/mystream_111014_170037_75515.aac
#EXTINF:10.00,
mystreamaudio/Seg_111014_170037_75/mystream_111014_170037_75516.aac
#EXTINF:10.00,
mystreamaudio/Seg_111014_170037_75/mystream_111014_170037_75517.aac
#EXTINF:10.00,
mystreamaudio/Seg_111014_170037_75/mystream_111014_170037_75518.aac
#EXTINF:10.00,
mystreamaudio/Seg_111014_170037_75/mystream_111014_170037_75519.aac
#EXTINF:10.00,
mystreamaudio/Seg_111014_170037_75/mystream_111014_170037_75520.aac
#EXTINF:10.00,
mystreamaudio/Seg_111014_170037_75/mystream_111014_170037_75521.aac
#EXTINF:10.00,
mystreamaudio/Seg_111014_170037_75/mystream_111014_170037_75522.aac
#EXTINF:10.00,
mystreamaudio/Seg_111014_170037_75/mystream_111014_170037_75523.aac
jul
  • 36,404
  • 64
  • 191
  • 318

1 Answers1

0

First #EXT-X-VERSION:3 protocol version 3 officially supported from Android 4.0 and above. Since Android 3.0 protocol version 2 is supported as mentioned in official docs. Main difference: version 2 does not allow floating point segment duration.

Second according to specification each segment must be in MPEG-TS format (.ts) which can contain AAC audio inside instead of just AAC container (.aac).

In Supported Media formats mentioned: "MPEG-2 TS media files only" which means you trying to play not supported m3u8 playlist. To fix it encode each segment as mpeg-ts which AAC audio stream inside.

dasar
  • 5,321
  • 4
  • 24
  • 36