1

m3u8 形式のビデオをバッファリングしており、この URL を MPMovieplayerController の contenturl として設定しています。

0.3 秒ごとに実行されるバックグラウンド スレッドを実行しています。これを使用して、バッファリングおよび再生時間をチェックし、それに応じてチェックを実行します。

if(!mPlaybackProgressTimer)
    mPlaybackProgressTimer = [[NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(didPlayback:) userInfo:nil repeats:YES] retain];

そしてdidplaybackで

..

- (void)didPlayback:(id)sender {

    NSTimeInterval totalDuration = [mVideoPlayerController duration];

    NSTimeInterval playbackTime = [mVideoPlayerController currentPlaybackTime];
    float playbackProgress = 0.0;

   if(playbackTime > 0.0 && totalDuration > 0.0)
       playbackProgress = playbackTime / totalDuration;

   mPercentWatched = round(100 * playbackProgress);

   NSTimeInterval bufferedTime = [mVideoPlayerController playableDuration];
   float bufferProgress = 0.0;

   if(playbackTime > 0.0 && totalDuration > 0.0)
       bufferProgress = bufferedTime / totalDuration;

   [self setProgress:bufferProgress forProgressType:eProgressTypeBuffer];
   [self setProgress:playbackProgress forProgressType:eProgressTypePlay];
}

問題は、特定の状況下でbufferedTime
が変動することです:- - m3u8 ファイルは、異なる解像度とビットレート用に別々のファイルに分割されています
- どの m3u8 ファイルがどの帯域幅に対応するかを決定する index.m3u8 ファイルがあります
- もちろんそうですm3u8ファイル全体を提供するのではなく、ユーザーが遅延なく最高のエクスペリエンスを得る方法に基づいて、個々の* .tsファイルを提供します(これはすべて内部で管理されます)-また、Apple開発者ガイドラインに従ってこれらすべてに従いました

なぜ変動が起こっているのかはわかりませんが、私には理にかなっているように思えます..一定量のデータがバッファリングされていますが、データが破棄されている可能性があると思います(単なる理論)

注: encoding.com を使用してメディアをセグメント化しています

更新: ログ

2013-01-14 11:46:57.731 IronStudios[7724:c07] バッファーの進行状況: 0.139779
2013-01-14 11:46:57.930 IronStudios[7724:c07] バッファーの進行状況: 0.139779
2013-01-14 11:46:58.130 IronStudios[7724:c07] バッファーの進行状況: 0.139790
2013-01-14 11:46:58.331 IronStudios[7724:c07] バッファーの進行状況: 0.139790
2013-01-14 11:46:58.530 IronStudios[7724:c07] バッファーの進行状況: 4 0.1250
2013-01-14 11:46:58.730 IronStudios[7724:c07] バッファーの進行状況: 0.126391
2013-01-14 11:46:58.930 IronStudios[7724:c07] バッファーの進行状況: 0.124450
2013-01-14 11:46:59.130 IronStudios[7724:c07] バッファ進行状況: 0.125799

ご覧のとおり、特定のインスタンスでバッファの進行状況が減少しています。

4

1 に答える 1

0

期間はダウンロードされた量から導出できますが、playableDuration は再生できるものから導出されます。

チャンク全体がダウンロードされると、iOS は mpeg2-ts チャンクの再生のみを開始します。

10 秒のチャンクを使用しているとします。

Downloaded: 2.2 chunks (22 seconds)
Playable:   2   chunks (20 seconds)
Progress bar = 2 / 2.2 = ~91%

数秒後……。

Downloaded: 2.9 chunks (29 seconds)
Playable:   2   chunks (20 seconds)
Progress bar = 2 / 2.9 = ~69%

プログレスバーが後退しました...

数秒後……。

Downloaded: 3.1 chunks (31 seconds)
Playable:   3   chunks (30 seconds)
Progress bar = 3 / 3.1 = ~97%

そしてまた前進…

于 2013-01-14T06:43:29.243 に答える