How to make AAC seekable over http stream using Android MediaPlayer?

Viewed 1212

I have an app using MediaPlayer that works fine when I stream progressive download MP3s. I have tried to use that same app to stream progress download AAC files. And it plays the files fine. What doesn't work is when I try to skip around in the stream using MediaPlayer.seekTo() with AAC. This again works fine in mp3. For the AAC stream it just restarts playing over at zero.

My feeling is that is encoding related. That AAC file hasn't been configured correctly to stream.

Here is the output from MediaInfo tool:

Size: 2.3 MB
Format: QuickTime/MPEG-4/Motion JPEG 2000 format
Stream count: 2
Duration: 00:05:02
Bit rate: 64 kb/s
Meta info:
    album_artist: Red Hot Chili Peppers
    album: The Getaway
    minor_version: 512
    encoder: Lavf57.41.100
    title: Dark Necessities
    major_brand: M4V 
    track: 2
    disc: 1
    compatible_brands: isomiso2avc1
    artist: Red Hot Chili Peppers
    copyright: 2016 Warner Bros. Records Inc.
    genre: Alternative

Stream 0
Type: video
Codec: h264
Codec profile: High 10
FourCC: avc1
Duration: 00:00:00
Width: 350
Height: 350
Sample aspect ratio: 1:1
Display aspect ratio: 1:1
Pixel format: yuv420p10le
Frame rate: 90000 fps
Meta info:
    handler_name: VideoHandler
    language: und

Stream 1
Type: audio
Codec: aac
FourCC: mp4a
Duration: 00:05:02
Bit rate: 64 kb/s
Sample rate: 44100 Hz
Sample format: s16
Channel: 2
Meta info:
    handler_name: SoundHandler
    language: und

You'll notice it's really a video file with AAC audio and no real video included. If that's the case then I figured it needs more metadata to know where to play when I ask for a portion of the stream that may or may not be loaded. Also videos need keyframes to know where to play from so I believe no keyframes or 'hint' boxes are included in the stream/file.

I haven't had any luck with finding any real details about what is missing or if this is possible or not. I've tested this on other versions and it seems that prior to 5.0.2 it worked. After 5.0.2 it does not work. I haven't found any details about what changed in that version.

So this could either be a stream encoding issue that doesn't allow us to stream this file over a progressive download http(s) stream. Or, it could be a bug in Android Media Player created sometime around 5.0.2 timeframe. Or it could be both.

Why isn't this working?

1 Answers
Related