Detect when switched to an audio only HLS Stream - ios

In our app, we have an HLS index file which contains multiple HLS streams for different Bandwidths. Our Lowest Badwidth stream is only audio.
We want to show a message to our users when the app has degraded to the Audio Only stream.
Is there a way to detect when we have switched to an audio only stream?
Thanks!

Related

Extract CMSampleBuffer from HLS video stream on iOS

How can I save what AVPlayer is currently playing (both video and audio) from Live HLS stream?
I know how to load and play m3u8 video file using AVPlayer.
Please note that the HLS stream is live and not Video on demand so cannot use AVAggregateAssetDownloadTask In the perfect scenario will get CMSampleBuffer objects which can save to file easily. Also AVPlayerItemOutput is not entirely an option because I am unable to see how will get the audio channel.
Seems not possible with the current SDK. I've implemented it using ffmpeg

How to record all audio generated from my app (might from AVPlayer or others) in iOS? (not mic)

There are many audio generated from my app, the sources could be AVPlayer, AudioUnit, etc. I want to record all the audio(not from mic because that would record user voice) into a single file. Is there any way to get the final mixed audio data before sent to the audio playback hardware?
I've tried AudioUnit, and The Amazing Audio Engine. However it could only record audio played by AudioUnit.
Also read the MTAudioProcessingTap, but it has to inject some code into AVPlayer, and seems complicated to mix all the audio.

Playing only audio from an HLS video stream when not connected to WiFi using Daily Motion's hls.js

This question is in regards to DailyMotion's hls.js API
My goal is to save on data usage when not connected to WiFi by playing only the audio portion of a HLS video stream.
I have looked at similar questions for other APIs but have not found anything relevant to the hls.js API.
Details:
I tested my live stream HLS file on your demo page. It identified 1 audio track and displayed it in the Audio Track Controls. At the bottom of this post I am including the format of my HLS file with identifying info changed.
Question:
Will the hsl.js API allow me to force the playback to only audio once I have identified the lack of a WiFi connection? What setting or command would I use to do that? Alternatively, can I force playback to the lowest resolution?
Thanks,
RKern
HLS File Format:
#EXTM3U
#EXT-X-VERSION:5
#EXT-UPLYNK-LIVE
#EXT-X-START:TIME-OFFSET=0.00
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="unspecified",LANGUAGE="en",AUTOSELECT=YES,DEFAULT=YES
#UPLYNK-MEDIA0:416x234x30,baseline-13,2x48000
#EXT-X-STREAM-INF:PROGRAM-ID=1,RESOLUTION=416x234,BANDWIDTH=471244,CODECS="mp4a.40.5,avc1.42000d",FRAME-RATE=30.000,AUDIO="aac",AVERAGE-BANDWIDTH=411975
http://content-ause1.uplynk.com/channel/test/d.m3u8?pbs=test
#UPLYNK-MEDIA0:704x396x30,main-30,2x48000
#EXT-X-STREAM-INF:PROGRAM-ID=1,RESOLUTION=704x396,BANDWIDTH=873267,CODECS="mp4a.40.5,avc1.4d001e",FRAME-RATE=30.000,AUDIO="aac",AVERAGE-BANDWIDTH=688830
http://content-ause1.uplynk.com/channel/test/e.m3u8?pbs=test
#UPLYNK-MEDIA0:896x504x30,main-31,2x48000
#EXT-X-STREAM-INF:PROGRAM-ID=1,RESOLUTION=896x504,BANDWIDTH=1554841,CODECS="mp4a.40.5,avc1.4d001f",FRAME-RATE=30.000,AUDIO="aac",AVERAGE-BANDWIDTH=1171051
http://content-ause1.uplynk.com/channel/test/f.m3u8?pbs=test
#UPLYNK-MEDIA0:1280x720x30,main-31,2x48000
#EXT-X-STREAM-INF:PROGRAM-ID=1,RESOLUTION=1280x720,BANDWIDTH=3328000,CODECS="mp4a.40.5,avc1.4d001f",FRAME-RATE=30.000,AUDIO="aac",AVERAGE-BANDWIDTH=2414865
http://content-ause1.uplynk.com/channel/test/g.m3u8?pbs=test
#UPLYNK-MEDIA0:192x108x15,baseline-11,2x48000
#EXT-X-STREAM-INF:PROGRAM-ID=1,RESOLUTION=192x108,BANDWIDTH=136226,CODECS="mp4a.40.5,avc1.42000b",FRAME-RATE=15.000,AUDIO="aac",AVERAGE-BANDWIDTH=120009
http://content-ause1.uplynk.com/channel/test/b.m3u8?pbs=test
#UPLYNK-MEDIA0:256x144x30,baseline-12,2x48000
#EXT-X-STREAM-INF:PROGRAM-ID=1,RESOLUTION=256x144,BANDWIDTH=259601,CODECS="mp4a.40.5,avc1.42000c",FRAME-RATE=30.000,AUDIO="aac",AVERAGE-BANDWIDTH=232565
http://content-ause1.uplynk.com/channel/test/c.m3u8?pbs=test

Intercept/modify audio stream on iOS

I am looking at the feasibility of getting the current raw audio stream playing and do stuff with it such as stream it over Bluetooth or equalize it, etc. Is there any way to do this in iOS 8?
For example: apps such as Pandora/Spotify are playing music and I want to access the audio they are playing.
To process audio from another app, that app needs to participate in Inter-App Audio.
I don't know if your example apps do that.

Stream only audio track from mp4 file

I have a remote MP4 file that has video and sound. I want to only stream the audio track of the mp4 file. I don't need the video and want to decrease the internet usage in my app. I have no idea where to start with this, Google doesn't seem to help. Is this impossible? Any ideas?
You can't... If you want audio only, you need to split video / audio on the server or put a stream software (like vlc, ffmpeg or mplayer) who can re-encode file in realtime (so you can drop video for new stream)
It's better, for me, to process all files on server and extract audio track...

Resources