Video streaming issue

917 views Asked by At

I am using MPMoviePlayerController for playing HLS i.e video streaming it works fine on good and average network (WIFI,3G) but not working properly on slow network (2G). Below is the piece of code for the same. Also on slow network seekbar is causing an issue, it moves upwards and player shows blank screen.

MPMoviePlayerController  *player = [[MPMoviePlayerController alloc] init];
player.allowsAirPlay = YES;
[self.view addSubview:player.view];
player.view.frame = CGRectMake(5.0, 64.0, [[UIScreen mainScreen] bounds].size.width - 10.0, viwVideo.frame.size.height - 10.0);
player.controlStyle = MPMovieControlStyleDefault;
player.movieSourceType = MPMovieSourceTypeFile;
[player setContentURL:[NSURL URLWithString:@"http://techxvweb.fr/html5/AppleOutput/2012-03-10-j23-dax-smr-mt1-m3u8-aapl.ism/manifest(format=m3u8-aapl)
"]];
[player play];
2

There are 2 answers

0
Abhi On

This is the the property of MPMoviePlayerController, If you play an audio file you will notice that seeker is permanently in center with blank screen till it gets next stream of data. Here you can add some loader in blank screen. also you can set the property of ShouldAutoPlay to No.

0
chad_ On

Apple's docs say:

First bit rate should be one that most clients can sustain The first entry in the variant playlist will be played at the initiation of a stream and is used as part of a test to determine which stream is most appropriate. The order of the other streams is irrelevant. Therefore, the first bit rate in the playlist should be the one that most clients can sustain.

You should create multiple playlists that have the same set of streams, but each with a different first entry that is appropriate for the target network. This ensures the user has a good experience when the stream is first played.

We recommend you point to a 150 Kbps stream for the cellular Variant Playlist.

We recommend you point to a 440 Kbps stream for the Wi-Fi Variant Playlist.

See Recommended Encoding Settings for HTTP Live Streaming Media.

Where possible, encode enough variants to provide the best quality stream across a wide range of connection speeds For example, encode variants at 64 Kbps, 110 Kbps, 200 Kbps, 350 Kbps, 550 Kbps, 900 Kbps and 1500 Kbps.

Audio/Video Stream Considerations Video aspect ratio must be exactly the same, but can be different dimensions.

We recommend 416 x 234 for 16:9 content and 400 x 300 for 4:3 content