I am writing an iOS app and I need to stream m4a files over HTTP Live Streaming. I am using AVPlayer and a HLS Simple Media Playlist file.

If I link AVPlayer directly to an mp3 or m4a, it streams with no issues.

URL = [NSURL URLWithString:@"http://fembotics.com/bells.m4a"];
item = [AVPlayerItem playerItemWithURL:URL];
player = [AVPlayer playerWithPlayerItem:item];
[player play];

The problem happens when I set URL to a HLS playlist. Strangely, mp3 works and m4a does not.

http://fembotics.com/basicmp3.m3u8 - Working

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:5220
#EXTINF:20.0,
/bells.mp3
#EXT-X-ENDLIST

http://fembotics.com/basicm4a.m3u8 - Broken

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:5220
#EXTINF:20.0,
/bells.m4a
#EXT-X-ENDLIST

I tried using absolute URLs in the playlists and it makes no difference.

Has anyone seen this type of issue before? Should I try other sources for my m4a files? (I tried one purchased from iTunes and one transcoded from wav by MediaHuman Audio Converter).

有帮助吗?

解决方案

m3u8 on iOS only supports segmented .aac an .ts containers.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top