Lecture VOD avec recherche dans le contenu principal vod-playback-with-seeking-in-the-main-content

Scénario scenario

Ce scénario comprend la recherche dans le contenu principal pendant la lecture.

Il s’agit du même scénario que le scénario Lecture VOD sans publicité, mais une partie du contenu est parcourue en défilement et une recherche est effectuée d’un point du contenu principal à un autre.

Déclencheur
Méthode Heartbeat
Appels réseau
Remarques
L’utilisateur clique sur Lecture.
trackSessionStart
Analytics Content Start, Heartbeat Content Start
Étant donné que la bibliothèque de mesures ignore la présence d’une publicité preroll, ces appels réseau sont identiques au scénario Lecture VOD sans publicité.
La première image du contenu s’affiche.
trackPlay
Heartbeat Content Play
Lorsque le contenu du chapitre est lu avant le contenu principal, le Heartbeats commence lorsque le chapitre commence.
Le contenu est lu
Content Heartbeats
Il s’agit du même appel réseau que le scénario Lecture VOD sans publicité.
L’utilisateur commence l’opération de recherche sur le contenu
trackSeekStart
Aucune pulsation n’est transmise avant la fin de la recherche, par exemple, trackSeekComplete
Fin de la recherche
trackSeekComplete
La transmission des pulsations commence puisque la recherche est terminée. Conseil : la valeur du curseur de lecture doit correspondre au nouveau curseur de lecture après la recherche.
Contenu terminé
trackComplete
Heartbeat Content Complete
Il s’agit du même appel réseau que le scénario Lecture VOD sans publicité.
Fin de la session
trackSessionEnd
SessionEnd

Exemple de code sample-code

Dans ce scénario, l’utilisateur effectue une recherche lors de la lecture du contenu principal.

Android

Pour afficher ce scénario dans Android, configurez le code suivant :

// Set up mediaObject
MediaObject mediaInfo = MediaHeartbeat.createMediaObject(
  Configuration.MEDIA_NAME,
  Configuration.MEDIA_ID,
  Configuration.MEDIA_LENGTH,
  MediaHeartbeat.StreamType.VOD
);

HashMap<String, String> mediaMetadata = new HashMap<String, String>();
mediaMetadata.put(CUSTOM_KEY_1, CUSTOM_VAL_1);
mediaMetadata.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, mediaMetadata);

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

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

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

// 3. Track the MediaHeartbeat.Event.SeekStart event when the user begins to seek.
_mediaHeartbeat.trackEvent(MediaHeartbeat.Event.SeekStart, null, null);

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

// 4. Track the MediaHeartbeat.Event.SeekComplete event when the user completes seeking
_mediaHeartbeat.trackEvent(MediaHeartbeat.Event.SeekComplete, null, null);

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

// 5. Call trackComplete() when the playback reaches the end, i.e., when the media
//    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 media to completion.
_mediaHeartbeat.trackSessionEnd();

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

iOS

Pour afficher ce scénario dans iOS, configurez le code suivant :

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

NSMutableDictionary *mediaContextData = [[NSMutableDictionary alloc] init];
[mediaContextData setObject:CUSTOM_VAL_1 forKey:CUSTOM_KEY_1];
[mediaContextData 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:mediaContextData];
.......
.......

// 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:ADBMediaHeartbeatEventSeekStart event when the user
//    begins to seek out of the chapter with the intent to skip it.
[_mediaHeartbeat trackEvent:ADBMediaHeartbeatEventSeekStart
               mediaObject:nil
               data:nil];
.......
.......

// 4. Track the trackEvent:ADBMediaHeartbeatEventSeekComplete event when the
//    user seeks out of the chapter with the intent to skip it.
[_mediaHeartbeat trackEvent:ADBMediaHeartbeatEventSeekComplete
               mediaObject:nil
               data:nil];
.......
.......

// 5. Call trackComplete when the playback reaches the end, i.e., 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 media to completion.
[_mediaHeartbeat trackSessionEnd];
.......
.......

JavaScript

Pour afficher ce scénario, saisissez le texte suivant :

// Set up mediaObject
var mediaInfo = MediaHeartbeat.createMediaObject(
  Configuration.MEDIA_NAME,
  Configuration.MEDIA_ID,
  Configuration.MEDIA_LENGTH,
  MediaHeartbeat.StreamType.VOD

);

var mediaMetadata = {
  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, mediaMetadata);

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

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

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

// 3. Track the MediaHeartbeat.Event.SeekStart event when the user
//    begins to seek.
this._mediaHeartbeat.trackEvent(MediaHeartbeat.Event.SeekStart);

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

// 4. Track the MediaHeartbeat.Event.SeekComplete event when the user
//    completes seeking.
this._mediaHeartbeat.trackEvent(MediaHeartbeat.Event.SeekComplete);

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

// 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 media to completion.
this._mediaHeartbeat.trackSessionEnd();

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