バッファリングがある VOD 再生 vod-playback-with-buffering

シナリオ scenario

このシナリオでは、VOD コンテンツを再生する際にバッファリングが発生します。

特に指定のない限り、このシナリオのネットワーク呼び出しは、広告のない VOD 再生シナリオの呼び出しと同じです。

トリガー
ハートビートメソッド
ネットワーク呼び出し
メモ
ユーザーが​ 再生 ​をクリックする
trackSessionStart
Analytics Content Start、Heartbeat Content Start
これは、再生 ​をクリックするユーザーか、自動再生イベントである可能性があります。
ビデオ再生の最初のフレーム。
trackPlay
Heartbeat Content Play
このメソッドは、タイマーをトリガーします。ハートビートは、再生が続く限り、10 秒ごとに送信されます。
コンテンツが再生されます。
Content Heartbeats
バッファリングが開始されます。
trackEvent:BufferStart
Heartbeat Buffer
コンテンツがバッファーされます。
Content Heartbeats
バッファリングが完了します。
trackEvent:BufferComplete
Heartbeat Buffer、Heartbeat Play
コンテンツが再生されます。
Content Heartbeats
コンテンツの再生が完了します。
trackComplete
Heartbeat Content Complete
再生ヘッドの終わりに達しました。
セッションが終了します。
trackSessionEnd
SessionEnd は、表示セッションの終端を意味します。この API は、ユーザーが最後までビデオを視聴していなくても、呼び出される必要があります。

パラメーター parameters

Heartbeat Buffer

パラメーター
メモ
s:event:type
"buffer"

サンプルコード sample-code

このシナリオでは、VOD コンテンツを再生する際にバッファリングが発生します。

Android

Android でこのシナリオを表示するには、以下のコードを設定します。

// Set up mediaObject

MediaObject mediaInfo = MediaHeartbeat.createMediaObject(
  Configuration.MEDIA_NAME,
  Configuration.MEDIA_ID,
  Configuration.MEDIA_LENGTH,
  MediaHeartbeat.StreamType.VOD

);

HashMap<String, String> videoMetadata = new HashMap<String, String>();
videoMetadata.put(CUSTOM_KEY_1, CUSTOM_VAL_1);
videoMetadata.put(CUSTOM_KEY_2, CUSTOM_VAL_2);

// 1. Call trackSessionStart() when the user clicks Play or if autoplay is used,
//    i.e., there is an intent to start playback.
_mediaHeartbeat.trackSessionStart(mediaInfo, videoMetadata);

......
......

// 2. Call trackPlay() when the playback actually starts, i.e., when the first
//    frame of the main content is rendered on the screen.
_mediaHeartbeat.trackPlay();

.......
.......

// 3. Track the MediaHeartbeat.Event.BufferStart event when the video player
//    goes into the buffering state and begins to buffer content.
_mediaHeartbeat.trackEvent(MediaHeartbeat.Event.BufferStart, null, null);

.......
.......

// 4. Track the MediaHeartbeat.Event.BufferComplete event when the video player
//    goes into the buffering state and begins to buffer content.
_mediaHeartbeat.trackEvent(MediaHeartbeat.Event.BufferComplete, null, null);

.......
.......

// 5. Call trackComplete() when the playback reaches the end, i.e., when the
//    video completes and finishes playing.
_mediaHeartbeat.trackComplete();

........
........

// 6. Call trackSessionEnd() when the playback session is over. This method must
//    be called even if the user does not watch the video to completion.
_mediaHeartbeat.trackSessionEnd();

........

iOS

iOS でこのシナリオを表示するには、以下のコードを設定します。

// Set up mediaObject
ADBMediaObject *mediaObject =
[ADBMediaHeartbeat createMediaObjectWithName:MEDIA_NAME
                   length:MEDIA_LENGTH
                   streamType:ADBMediaHeartbeatStreamTypeVOD];

NSMutableDictionary *videoContextData = [[NSMutableDictionary alloc] init];
[videoContextData setObject:CUSTOM_VAL_1 forKey:CUSTOM_KEY_1];
[videoContextData setObject:CUSTOM_VAL_2 forKey:CUSTOM_KEY_2];

// 1. Call trackSessionStart when the user clicks Play or if autoplay is used,
//    i.e., there is an intent to start playback.
[_mediaHeartbeat trackSessionStart:mediaObject data:videoContextData];
.......
.......

// 2. Call trackPlay when the playback actually starts, i.e., when the first
//    frame of the main content is rendered on the screen.
[_mediaHeartbeat trackPlay];
.......
.......

// 3. Track the trackEvent:ADBMediaHeartbeatEventBufferStart event when the
//    video player goes in buffering state and begins to buffer content.
[_mediaHeartbeat trackEvent:ADBMediaHeartbeatEventBufferStart
               mediaObject:nil
               data:nil];
.......
.......

// 4. Track the trackEvent:ADBMediaHeartbeatEventBufferComplete event when
//    the video player goes in buffering state and begins to buffer content.
[_mediaHeartbeat trackEvent:ADBMediaHeartbeatEventBufferComplete
               mediaObject:nil
               data:nil];
.......
.......

// 5. Call trackComplete when the playback reaches the end, i.e., when the
//    video completes and finishes playing.
[_mediaHeartbeat trackComplete];
.......
.......

// 6. Call trackSessionEnd when the playback session is over. This method must
//    be called even if the user does not watch the video to completion.
[_mediaHeartbeat trackSessionEnd];
.......
.......

JavaScript

このシナリオを表示するには、以下のテキストを入力します。

// Set up mediaObject

var mediaInfo = MediaHeartbeat.createMediaObject(
  Configuration.MEDIA_NAME,
  Configuration.MEDIA_ID,
  Configuration.MEDIA_LENGTH,
  MediaHeartbeat.StreamType.VOD

);

var videoMetadata = {
  CUSTOM_KEY_1 : CUSTOM_VAL_1,
  CUSTOM_KEY_2 : CUSTOM_VAL_2,
  CUSTOM_KEY_3 : CUSTOM_VAL_3
};

// 1. Call trackSessionStart() when Play is clicked or if autoplay is used,
//    i.e., there's an intent to start playback.
this._mediaHeartbeat.trackSessionStart(mediaInfo, videoMetadata);

......
......

// 2. Call trackPlay() when the playback actually starts, i.e., when the
//    first frame of the ad video is rendered on the screen.
this._mediaHeartbeat.trackPlay();

.......
.......

// 3. Track event MediaHeartbeat.Event.BufferStart when the video player
//    goes into the buffering state and begins to buffer content.
this._mediaHeartbeat.trackEvent(MediaHeartbeat.Event.BufferStart);

.......
.......

// 4. Track the MediaHeartbeat.Event.BufferComplete event when the
//    video player goes into the buffering state and begins to buffer content.
this._mediaHeartbeat.trackEvent(MediaHeartbeat.Event.BufferComplete);

.......
.......

// 5. Call trackComplete() when the playback reaches the end, i.e.,
//    when playback completes and finishes playing.
this._mediaHeartbeat.trackComplete();

........
........

// 6. Call trackSessionEnd() when the playback session is over. This method must
//    be called even if the user does not watch the video to completion.
this._mediaHeartbeat.trackSessionEnd();

........
........
recommendation-more-help
c8eee520-cef5-4f8c-a38a-d4952cfae4eb