KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to stream audio to iOS and Safari clients using Apple's HTTP Live Streaming protocol. Unlike many common implementations of HTTP Live Streaming, my goal is to use short audio clips that by nature are of varying lengths, mostly in the 10-30 second range. In addition to streaming the audio from these segments, I would like to access metadata for each segment so I can update the display and/or give the user additional options to get more information about a particular audio segment. Currently I've set up a few test cases that convert my source audio (MP3) to various formats and create streaming M3U files to test on iOS devices, but none of my approaches have worked properly (streaming correctly and passing metadata to the client). I am using AVPlayer to load and play the created M3U files: _playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://localhost/sample.m3u8"]] _player = [[AVPlayer alloc] initWithPlayerItem:_playerItem]; [_playerItem addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:NULL]; // ... wait for user input [_player play]; Approach 1: Raw MP3 files I took my original source MP3 files with id3v2 (v2.3.0) metadata and added them to an M3U playlist. #EXTM3U #EXT-X-TARGETDURATION:23 #EXT-X-MEDIA-SEQUENCE:0 #EXTINF:14 http://localhost/trk_01.mp3 #EXTINF:22 http://localhost/trk_02.mp3 #EXTINF:16 http://localhost/trk_03.mp3 #EXT-X-ENDLIST Results: The timedMetadata property is updated as soon as playback starts with the correct ID3 information for the first track. The first track plays, but cuts off near the end. ID3 data for the second track shows up, but the second track does not start playing. After a few moments I get an error to the console:
Tags (comma-separated)
Save Edits
Cancel