Rich Media

 

Foreword

AT Internet’s SDK allows you to tag videos and audio media played by the user during app usage.

 

Get off to a good start

Once your tag has been initialised, you can begin tagging your videos and audio media.

To use SDK class and methods, add ATInternet namespace to your Page.

 

Tagging

Rich Media tagging is not accounted for in the Dispatch mechanism!

The tracker makes available a MediaPlayers object. This object exposes the following methods:

  • Add: Enables the addition of a new player and returns a MediaPlayer object
  • Remove: Delete a player
  • RemoveAll: Delete all players

When a player is deleted, if media is currently being played, a hit will be automatically sent in order to stop measurement.

public MainPage()
{
     this.InitializeComponent();
     tracker = SmartTag.Instance.defaultTracker;
     MediaPlayer player1 = tracker.MediaPlayers.Add(78);
     // new player with default ID
     MediaPlayer player2 = tracker.MediaPlayers.Add();
     tracker.MediaPlayers.Remove(78);
     tracker.MediaPlayers.RemoveAll();
}

Once a player is instantiated, it is possible to tag videos and audio media.

All objects listed below expose the following methods:

  • SendPlay: Sends a media play hit with a refresh hit sent automatically every 5 seconds
  • SendPlay with refresh period: Same as above, except it is possible to specify the refresh period (the specified parameter cannot be less than 5, which is the minimum period EXCEPT if the parameter is set to 0, in which case refreshing is not enabled!)
  • SendPause: Sends a hit when media has been paused
  • SendStop: Sends a hit when media playback has been stopped completely
  • SendMove : Sends a hit when the player’s play cursor has been moved
 

Video

The MediaPlayer object makes a Videos object available. This object exposes the following methods:

  • Add: Enables the addition of a video to the player and returns a Video object
  • Remove: Deletes a video
  • RemoveAll: Deletes all videos
 

Tagging examples

  1. Tagging a video play with refresh period by default
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            Video video;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker = SmartTag.Instance.defaultTracker;
                MediaPlayer player = tracker.MediaPlayers.Add();
                video = player.Videos.Add("movie",90);
            }
    
            private void onVideoStart()
            {
                video.SendPlay(0);
            }
        }
    }
  2. Tagging a video play with refresh (refresh period cannot be less than 5 seconds)
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            Video video;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker = SmartTag.Instance.defaultTracker;
                MediaPlayer player = tracker.MediaPlayers.Add();
                video = player.Videos.Add("movie",90);
            }
    
            private void onVideoStart()
            {
                // set refresh to 10 seconds
                // /!\ can't set below 5s
                video.SendPlay(10);
            }
        }
    }
  3. Tagging a video ‘pause’
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            Video video;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker = SmartTag.Instance.defaultTracker;
                MediaPlayer player = tracker.MediaPlayers.Add();
                video = player.Videos.Add("movie",90);
            }
    
            private void onVideoStart()
            {
                video.SendPlay(10);
            }
    
            private void onVideoPause()
            {
                video.SendPause();
            }
        }
    }
  4. Tagging a video ‘stop’
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            Video video;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker = SmartTag.Instance.defaultTracker;
                MediaPlayer player = tracker.MediaPlayers.Add();
                video = player.Videos.Add("movie",90);
            }
    
            private void onVideoStart()
            {
                video.SendPlay(10);
            }
    
            private void onVideoStop()
            {
                video.SendStop();
            }
        }
    }
  5. Tagging cursor movement on the video
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            Video video;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker = SmartTag.Instance.defaultTracker;
                MediaPlayer player = tracker.MediaPlayers.Add();
                video = player.Videos.Add("movie",90);
            }
    
            private void onVideoStart()
            {
                video.SendPlay(10);
            }
    
            private void onVideoMove()
            {
                video.SendMove();
            }
        }
    }
 

LiveVideo

The MediaPlayer object makes a LiveVideos object available. This object exposes the following methods:

  • Add: Enables the addition of a live video to the player and returns a LiveVideo object
  • Remove: Deletes a live video
  • RemoveAll: Deletes all live videos
 

Tagging examples

  1. Tagging a live video play without refresh
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            LiveVideo liveVideo;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                liveVideo = player.LiveVideos.Add("live video");
            }
    
            private void onLiveStart()
            {
                liveVideo.SendPlay(0);
            }
        }
    }
  2. Tagging a live video play with refresh (refresh period cannot be less than 5 seconds)
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            LiveVideo liveVideo;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                liveVideo = player.LiveVideos.Add("live video");
            }
    
            private void onLiveStart()
            {
                // refresh every 5s
                liveVideo.SendPlay();
            }
        }
    }
  3. Tagging a live video ‘pause’
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            LiveVideo liveVideo;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                liveVideo = player.LiveVideos.Add("live video");
            }
    
            private void OnLivePause()
            {
                // refresh every 5s
                liveVideo.SendPause();
            }
        }
    }
  4. Tagging a live video ‘stop’
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            LiveVideo liveVideo;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                liveVideo = player.LiveVideos.Add("live video");
            }
    
            private void OnLiveStop()
            {
                liveVideo.SendStop();
            }
        }
    }
  5. Tagging cursor movement on a live video
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            LiveVideo liveVideo;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                liveVideo = player.LiveVideos.Add("live video");
            }
    
            private void OnLiveMove()
            {
                liveVideo.SendMove();
            }
    }
 

Audio

The MediaPlayer object makes an Audios object available. This object exposes the following methods:

  • add: Enables the addition of audio media to the player and returns an Audio object.
  • remove: Deletes an audio media
  • removeAll: Deletes all audio media
 

Tagging examples

  1. Tagging audio media play without refresh
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            Audio audio;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.mediaPlayers.Add();
                audio = player.audio.Add("audio", 10);
            }
    
            private void onAudioStart()
            {
                audio.SendPlay(0);
            }
    }
  2. Tagging audio media play with refresh (refresh period cannot be less than 5 seconds)
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            Audio audio;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.DefaultTracker;
                player    = tracker.MediaPlayers.Add();
                audio = player.Audio.Add("audio", 10);
            }
    
            private void OnAudioStart()
            {
                // refresh every 5s
                audio.SendPlay();
    
                // refresh every 10s
                audio.SendPlay(10);
            }
        }
    }
  3. Tagging an audio media ‘pause’
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            Audio audio;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                audio = player.Audio.Add("audio");
            }
    
            private void OnAudioPause()
            {
                audio.SendPause();
            }
    }
  4. Tagging an audio media ‘stop’
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            Audio audio;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                audio = player.Audio.Add("audio");
            }
    
            private void OnAudioStop()
            {
                audio.SendStop();
            }
    }
  5. Tagging cursor movement on audio media
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            Audio audio;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                audio = player.Audio.Add("audio");
            }
    
            private void OnAudioMove()
            {
                audio.SendMove();
            }
        }
    }
 

LiveAudio

The MediaPlayer object makes a LiveAudios object available. This object exposes the following methods:

  • Add: Enables the addition of live audio media to the player and returns a LiveAudio object.
  • Remove: Deletes a live audio media
  • RemoveAll: Deletes all live audio media
 

Tagging examples

  1. Tagging a live audio media play without refresh
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            LiveAudio liveAudio;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                liveAudio = player.LiveAudios.Add("live audio");
            }
    
            private void OnLiveAudioStart()
            {
                liveAudio.SendStart(0);
            }
        }
    }
  2. Tagging a live audio media play with refresh (refresh period cannot be less than 5 seconds)
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            LiveAudio liveAudio;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                liveAudio = player.LiveAudios.Add("live audio");
            }
    
            private void OnLiveAudioStart()
            {
                // default : refresh every 5s
                liveAudio.SendStart(10);
    
                // refresh every 10s
                liveAudio.SendStart(10);
            }
        }
    }
  3. Tagging a live audio media ‘pause’
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            LiveAudio liveAudio;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                liveAudio = player.LiveAudios.Add("live audio");
            }
    
            private void OnLiveAudioPause()
            {
                liveAudio.SendPause(10);
            }
        }
    }
  4. Tagging a live audio media ‘stop’
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            LiveAudio liveAudio;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                liveAudio = player.LiveAudios.Add("live audio");
            }
    
            private void OnLiveAudioStop()
            {
                liveAudio.SendStop();
            }
        }
    }
  5. Tagging cursor movement on live audio media
    using System;
    using System.Collections.Generic;
    using Windows.Data.Json;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using ATInternet;
    using Windows.UI.Xaml.Navigation;
    
    namespace App1
    {
        public sealed partial class MainPage : Page
        {
            Tracker tracker;
            MediaPlayer player
            LiveAudio liveAudio;
    
            public MainPage()
            {
                this.InitializeComponent();
                tracker   = SmartTag.Instance.defaultTracker;
                player    = tracker.MediaPlayers.Add();
                liveAudio = player.LiveAudios.Add("live audio");
            }
    
            private void OnLiveAudioMove()
            {
                liveAudio.SendMove();
            }
        }
    }
 

Shared properties

Name Type Default value Description
Name String Empty string Gets or sets the name of the viewed media
Chapter1 String? null Gets or sets the first chapter
Chapter2 String? null Gets or sets the second chapter
Chapter3 String? null Gets or sets the third chapter
Action Enum null Gets or sets the action type
Level2 Int? -1 Gets or sets the level 2 ID
IsBuffering Bool? false Indique si le média est en “buffering”
IsEmbedded Bool? false Indicates if the media is external to the application
Webd@omain String? null Gets or sets the media referrer in case of external placements (isEmbedded at true)
 

MediaPlayer class

 

Properties

Name Type Default value Description
PlayerId Int 1 Gets or sets the player ID
Videos Videos null Gets the instance allowing video management
Audios Audios null Gets the instance allowing audio media management
LiveVideos LiveVideos null Gets the instance allowing live video management
LiveAudios LiveAudios null Gets the instance allowing live audio media management

Management of player ID is automatic but you can nonetheless specify one.

 

Video class

 

Properties

Name Type Default value Description
Duration Int 0 Gets or sets total video length, in seconds
 

Audio class

 

Properties

Name Type Default value Description
Duration Int 0 Gets or sets total audio media length, in seconds
 

Methods

Name Return type Description
SendPlay() void Sends a play hit with an automatic refresh of 5 seconds
SendPlay(refreshDuration: Int) void Sends the play hit with an automatic refresh, given in parameters (0 = refresh disabled)
SendPause void Sends ‘pause’ hit
SendStop void Sends ‘stop’ hit
SendMove void Sends ‘play cursor’ movement hit
 

Was this post helpful?

Last update: 26/12/2018