I have a video and audio streaming urls.I want to check the user's band width if its slow it should play the audio. If its fast enough should play the video. How can I check whether the bandwidth is slow or fast in swift
m3u8 Structure
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM- INF:BANDWIDTH=814508,CODECS="avc1.66.51,mp4a.40.34",RESOLUTION=720x576 chunklist_w247403833.m3u8
If your video and audio files are of the same content, then you should be able to configure a m3u8 file for your needs. I've not done this in practice but you should be able to create a m3u8 file like the example below and Apple's media streamer should then automatically detect the bandwidth and play the appropriate file, and as the bandwidth changes Apple should automatically switch files to provide the best experience
(you'll need to tweak the file below but this should give you a head start)
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=216000,RESOLUTION=400x300
amazingVideo.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=100000,RESOLUTION=400x300
justAudio.m3u8