Rich Media

  • iOS
  • watchOS
  • tvOS
 

Avant-propos

Le SDK Internet vous permet de marquer les vidéos et médias audio joués par l’utilisateur durant l’utilisation de
l’application.

 

Pour bien débuter

Une fois votre marqueur initialisé, vous pouvez débuter le marquage de vos vidéos et de vos médias audio.

Dans le cas d’un projet Swift,
veillez à importer le module SmartTracker (ou tvOSTracker/watchOSTracker si votre target est une Apple TV ou une
Apple Watch) dans votre ViewController.

 

Marquage

Le marquage RichMedia n’est pas pris en compte dans la mécanique du dispatch !

Le tracker met à disposition un objet MediaPlayers. Cet objet expose les méthodes suivantes :

  • add : Permet de renseigner un nouveau player et retourne un objet MediaPlayer
  • remove : Supprime un player
  • removeAll : Supprime tous les players

Lors de la suppression d’un player, si un média est en cours de lecture ou en pause, un hit sera automatiquement envoyé afin d’arrêter la mesure.

import UIKit
import Tracker

class ViewController: UIViewController {

    let tracker = ATInternet.sharedInstance.defaultTracker

    override func viewDidLoad() {
        super.viewDidLoad()

        // New player with ID
        let player1 = tracker.mediaPlayers.add(78)

        // New player with default ID
        let player2 = tracker.mediaPlayers.add()

        // Remove the player 78
        tracker.mediaPlayers.remove(78)

        // Remove all the players
        tracker.mediaPlayers.removeAll()
    }

}
#import "ViewController.h"
#import "SmartTracker/SmartTracker-Swift.h"

@interface ViewController ()

@property (nonatomic, strong) Tracker *tracker;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.tracker = [[ATInternet sharedInstance] defaultTracker];

    // New player with ID
    MediaPlayer *player1 = [self.tracker.mediaPlayers add:78];

    // New player with default ID
    MediaPlayer *player2 = [self.tracker.mediaPlayers add];

    // Remove the player 78
    [self.tracker.mediaPlayers remove:78];

    // Remove all the players
    [self.tracker.mediaPlayers removeAll];
}

@end
Une fois qu’un player est instancié, il est possible de marquer les vidéos et média audio.

Tous les objets présentés
ci-dessous exposent les méthodes suivantes :

  • sendPlay :
    • < 2.9.0 : Envoie un hit de lecture d’un média avec un hit de rafraîchissement
      envoyé automatiquement toutes les 5 secondes
    • >= 2.9.0 : Envoie un hit de lecture d’un média avec un hit de rafraîchissement
      envoyé automatiquement en suivant la définition des paliers suivants :

      • Toutes les 5 secondes pendant la première minute
      • Toutes les 15 secondes entre la seconde et la cinquième minute
      • Toutes les 30 secondes entre la sixième et la dixième minute
      • Toutes les minutes à partir d’une durée de lecture > 10 minutes
  • sendPlay avec période de rafraîchissement (déprécié en version 2.9.0) :
    Envoie un hit de lecture d’un média avec une période de rafraîchissement personnalisée (le paramètre
    renseigné ne peut être inférieur à 5 qui est la période minimale SAUF si le paramètre vaut 0 auquel cas le
    rafraîchissement n’est pas activé !)
  • >= 2.9.0 :
    • sendPlay avec rafraîchissement dynamique : Envoie un hit de lecture d’un média avec des hits de
      rafraîchissement envoyés selon des paliers personnalisés
    • sendPlayWithoutRefresh() : Envoie un hit de lecture d’un média sans rafraichissement
    • sendResume : Envoie un hit de lecture en reprenant le rafraîchissement dynamique
  • sendPause : Envoie un hit de mise en pause du média
  • sendStop : Envoie un hit d’arrêt complet de la lecture du média
  • sendMove : Envoie un hit de déplacement du curseur de lecture du player
 

Refresh dynamique (>= 2.9.0)

La méthode sendPlay d’un média a été améliorée  pour optimiser un envoi de hit de refresh trop fréquent.
Désormais la méthode sendPlay prendra en paramètre un Dictionary<Int, Int> sous la
forme [0: 5, 2: 10, 3: 20] signifiant :

  • De 0 à 2 minutes de média consommé (non affecté par un sendMove), un hit de rafraîchissement sera
    envoyé toutes les 5 secondes.
  • De 2 à 3 minutes, un hit de rafraîchissement sera envoyé toutes les 10 secondes.
  • Au-delà de 3 minutes, un hit de rafraîchissement sera envoyé toutes les 20 secondes.

Dans le cas d’un sendPause(), la méthode sendResume() sera utilisée pour
reprendre et conserver la lecture et le rafraîchissement dynamique. Si un sendPlay(_) est appelé au
lieu d’un sendResume(), la configuration dynamique est réinitialisée et repart du début.

 

Video

L’objet MediaPlayer met à disposition un objet Videos. Cet objet
expose les méthodes suivantes :

  • add : Permet d’ajouter une vidéo au player et retourne un objet
    Video
  • remove : Supprime une vidéo
  • removeAll : Supprime toutes les vidéos
 

Exemples de marquage

  1. Marquage d’une lecture de vidéo avec la période de rafraîchissement par défaut ( [0:5, 1:15, 5:30, 10:60] )
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillAppear(animated: Bool) {
            let video = player.videos.add("movie", duration: 122)
            video.sendPlay()
    
            /// with buffering (>= 2.11.0)
            video.sendPlay(true)
        }
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOLL)animated {
        self.video = [self.player.videos add:@"movie" duration:122];
        [self.video sendPlay];
    
        /// with buffering (>= 2.11.0)
        [self.video sendPlayWithIsBuffering:YES];
    }
    
    @end
    
  2. Marquage d’une lecture de video avec rafraîchissement dynamique
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillAppear(animated: Bool) {
            let video = player.videos.add("movie", duration: 122)
            video.sendPlay(dynamicRefreshConfiguration: [0: 5, 1:10, 3: 30])
    
            /// with buffering (>= 2.11.0)
            video.sendPlay(dynamicRefreshConfiguration:[0: 5, 1:10, 3: 30], isBuffering:true)
        }
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Video *video;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.video = [self.player.videos add:@"movie" duration:122];
        [self.video sendPlayWithDynamicRefreshConfiguration: @{@0:@5, @1:@15, @5:@30, @10:@60}];
    
        /// with buffering (>= 2.11.0)
        [self.video sendPlayWithDynamicRefreshConfiguration:@{@0:@5, @1:@15, @5:@30, @10:@60} isBuffering:YES];
    }
    
    @end
  3. Marquage de video avec thèmes (ancien chapitre)
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillAppear(animated: Bool) {
            let video= player.videos.add("movie", mediaTheme1:"theme1", mediaTheme2:"theme2", duration:122)
        }
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        Video *video = [self.player.videos add:@"movie" mediaTheme1:@"theme1" mediaTheme2:@"theme2" duration:122];
    }
    @end
    
  4. Marquage d’une pause dans la vidéo
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var video: Video!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillDisappear(animated: Bool) {
            video.sendPause()
        }
    
        override func viewWillAppear(animated: Bool) {
            video = player.videos.add("movie", duration: 122)
            video.sendPlay()
        }
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Video *video;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
        [self.video sendPause];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.video = [self.player.videos add:@"movie" duration:122];
        [self.video sendPlay];
    }
    
    @end
    
  5. Marquage d’un stop dans la vidéo
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var video: Video!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillDisappear(animated: Bool) {
            video.sendStop()
        }
    
        override func viewWillAppear(animated: Bool) {
            video = player.videos.add("movie", duration: 122)
            video.sendPlay()
        }
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Video *video;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
        [self.video sendStop];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.video = [self.player.videos add:@"movie" duration:122];
        [self.video sendPlay];
    }
    
    @end
    
  6. Marquage d’information de la vidéo
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var myVideo: Video!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillAppear(animated: Bool) {
            myVideo = player.videos.add("movie", duration: 122)
            myVideo.sendPlay()
    
            /// >= 2.11.0
            myVideo.sendInfo()
            myVideo.sendInfo(true)
        }
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Video *myVideo;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.myVideo = [self.player.videos add:@"movie" duration:122];
        [self.myVideo sendPlay];
    
        /// (>= 2.11.0)
        [myVideo sendInfo]
        [myVideo sendInfoWithIsBuffering:YES]
    }
    
    @end
    
  7. Marquage d’autres actions de la vidéo
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var video: Video!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        // Custom method
        func othersActions() {
            video.sendMove()
            video.sendShare()
            video.sendEmail()
            video.sendDownload()
            video.sendFavor()
        }
    
        override func viewWillAppear(animated: Bool) {
            video = player.videos.add("movie", duration: 122)
            video.sendPlay()
        }
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Video *video;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    // Custom method
    - (void)othersActions {
        [self.video sendMove];
        [self.video sendEmail];
        [self.video sendDownload];
        [self.video sendShare];
        [self.video sendFavor];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.video = [self.player.videos add:@"movie" duration:122];
        [self.video sendPlay];
    }
    
    @end
    
 

LiveVideo

L’objet MediaPlayer met à disposition un objet LiveVideos.
Cet objet expose les méthodes suivantes :

  • add : Permet d’ajouter une vidéo live au player et retourne un objet LiveVideo
  • remove : Supprime une vidéo live
  • removeAll : Supprime toutes les vidéos live
 

Exemples de marquage

  1. Marquage d’une lecture de vidéo live sans rafraîchissement
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillAppear(animated: Bool) {
            let liveVideo = player.liveVideos.add("movie")
            liveVideo.sendPlayWithoutRefresh()
    
            /// with buffering (>= 2.11.0)
            liveVideo.sendPlayWithoutRefresh(true)
        }
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        LiveVideo *liveVideo = [self.player.liveVideos add:@"movie"];
    
        [liveVideo sendPlayWithoutRefresh];
        /// with buffering (>= 2.11.0)
        [liveVideo sendPlayWithoutRefreshWithIsBuffering:YES];
    }
    
    @end
  2. Marquage d’une lecture de vidéo live avec rafraîchissement (la période de rafraîchissement ne peut pas être
    inférieure à 5s)
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillAppear(animated: Bool) {
            let liveVideo = player.liveVideos.add("movie")
            // Refresh duration 10sec
            liveVideo.sendPlay(10)
    
            /// with buffering (>= 2.11.0)
            liveVideo.sendPlay(true)
        }
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        LiveVideo *liveVideo = [self.player.liveVideos add:@"movie"];
        // Refresh duration 10sec
        [liveVideo sendPlay:10];
    
        /// with buffering (>= 2.11.0)
        [liveVideo sendPlayWithIsBuffering:YES];
    }
    
    @end
  3. Marquage d’une pause dans la vidéo live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var liveVideo: LiveVideo!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillDisappear(animated: Bool) {
            liveVideo.sendPause()
        }
    
        override func viewWillAppear(animated: Bool) {
            liveVideo = player.videos.add("movie", mediaTheme1:"theme1")
            liveVideo.sendPlay()
        }
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Video *liveVideo;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
        [self.liveVideo sendPause];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.liveVideo = [self.player.liveVideos add:@"movie" mediaTheme1:@"theme1"];
        [self.liveVideo sendPlay];
    }
    
    @end
    
  4. Marquage d’un stop dans la vidéo live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var liveVideo: LiveVideo!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillDisappear(animated: Bool) {
            liveVideo.sendStop()
        }
    
        override func viewWillAppear(animated: Bool) {
            liveVideo = player.liveVideos.add("movie")
            liveVideo.sendPlay()
        }
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Video *liveVideo;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
        [self.liveVideo sendStop];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.liveVideo = [self.player.liveVideos add:@"movie"];
        [self.liveVideo sendPlay];
    }
    
    @end
    
  5. Marquage d’information de la vidéo live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var liveVideo: LiveVideo!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillAppear(animated: Bool) {
            liveVideo = player.liveVideos.add("movie")
            liveVideo.sendPlay()
    
            ///>= 2.11.0
            liveVideo.sendInfo()
            /// with buffering
            liveVideo.sendInfo(true)
        }
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) LiveVideo *liveVideo;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.liveVideo = [self.player.liveVideos add:@"movie"];
        [self.liveVideo sendPlay];
    
        ///>= 2.11.0
        [self.liveVideo sendInfo];
        /// with buffering
        [self.liveVideo sendInfoWithIsBuffering:YES];
    }
    
    @end
    
  6. Marquage d’autres actions de la vidéo live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var liveVideo: LiveVideo!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        // Custom method
        func othersActions() {
            liveVideo.sendMove()
            ///>= 2.11.0
            liveVideo.sendShare()
            liveVideo.sendEmail()
            liveVideo.sendFavor()
            liveVideo.sendDownload()
        }
    
        override func viewWillAppear(animated: Bool) {
            liveVideo = player.liveVideos.add("movie")
            liveVideo.sendPlay()
        }
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) LiveVideo *liveVideo;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    // Custom method
    - (void)othersActions {
        [self.liveVideo sendMove];
        ///>= 2.11.0
        [self.liveVideo sendDownload];
        [self.liveVideo sendShare];
        [self.liveVideo sendFavor];
        [self.liveVideo sendEmail];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.liveVideo = [self.player.liveVideos add:@"movie"];
        [self.liveVideo sendPlay];
    }
    
    @end
    
 

Audio

L’objet MediaPlayer met à disposition un objet Audios. Cet
objet expose les méthodes suivantes :

  • add : Permet d’ajouter un média audio au player et retourne un objet
    Audio.
  • remove : Supprime un média audio
  • removeAll : Supprime tous les médias audio
 

Exemples de marquage

  1. Marquage d’une lecture de média audio sans rafraîchissement
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillAppear(animated: Bool) {
            let audio = player.audios.add("song", duration:122)
    
            audio.sendPlay(0)
        }
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Audio *audio;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.audio = [self.player.audios add:@"song" duration:122];
        [self.audio sendPlay];
    }
    @end
    
  2. Marquage d’une lecture de média audio avec rafraîchissement (la période de rafraîchissement ne peut pas être
    inférieure à 5s)
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillAppear(animated: Bool) {
            let audio = player.audios.add("song", duration:122)
    	    // Refresh duration 10sec
            audio.sendPlay(10)
    
            /// with buffering (>= 2.11.0)
            audio.sendPlay(true)
        }
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        Audio *a = [self.player.audios add:@"song" duration:122];
        // Refresh duration 10 seconds
        [a sendPlay:10];
    
        /// with buffering (>= 2.11.0)
        [a sendPlayWithIsBuffering:YES];
    }
    @end
    
  3. Marquage d’une pause dans le média audio
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var audio: Audio!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillDisappear(animated: Bool) {
            audio.sendPause()
        }
    
        override func viewWillAppear(animated: Bool) {
            audio = player.audios.add("song", mediaTheme1:"theme1", mediaTheme2:"theme2", mediaTheme3:"theme3", duration: 122)
            audio.sendPlay()
        }
    
    }
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Audio *audio;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
        [self.audio sendPause];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.audio = [self.player.audios add:@"song" mediaTheme1:@"theme1" mediaTheme2:@"theme2" mediaTheme3: @"theme3" duration:122];
        [self.audio sendPlay];
    }
    
    @end
    
  4. Marquage d’un stop dans le média audio
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var audio: Audio!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillDisappear(animated: Bool) {
            audio.sendStop()
        }
    
        override func viewWillAppear(animated: Bool) {
            audio = player.audios.add("song", duration: 122)
            audio.sendPlay()
        }
    
    }
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Audio *audio;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
        [self.audio sendStop];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.audio = [self.player.audios addWithName:@"song" duration:122];
        [self.audio sendPlay];
    }
    
    @end
    
  5. Marquage d’information du média audio
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var audio: Audio!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        override func viewWillAppear(animated: Bool) {
            audio = player.audios.add("song", duration: 122)
            audio.sendPlay()
    
            /// >= 2.11.0
            audio.sendInfo()
            /// with buffering
            audio.sendInfo(true)
        }
    
    }
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Audio *audio;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
        self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.audio = [self.player.audios addWithName:@"song" duration:122];
        [self.audio sendPlay];
    
        /// >= 2.11.0
        [self.audio sendInfo];
        /// with buffering
        [self.audio sendInfoWithIsBuffering:YES];
    }
    
    @end
    
  6. Marquage d’autres actions du média audio
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
        let tracker = ATInternet.sharedInstance.defaultTracker
        var player: MediaPlayer!
        var audio: Audio!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            player = tracker.mediaPlayers.add()
        }
    
        // Custom method
        func othersActions() {
            audio.sendMove()
            /// >= 2.11.0
            audio.sendEmail()
            audio.sendShare()
            audio.sendFavor()
            audio.sendDownload()
        }
    
        override func viewWillAppear(animated: Bool) {
            audio = player.audios.add("song", duration: 122)
            audio.sendPlay()
        }
    
    }
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Audio *audio;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
        self.player = [self.tracker.mediaPlayers add];
    }
    
    // Custom method
    - (void)othersActions {
        [self.audio sendMove];
        /// >= 2.11.0
        [self.audio sendEmail];
        [self.audio sendFavor];
        [self.audio sendDownload];
        [self.audio sendShare];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        self.audio = [self.player.audios addWithName:@"song" duration:122];
        [self.audio sendPlay];
    }
    
    @end
    
 

LiveAudio

L’objet MediaPlayer met à disposition un objet LiveAudios.
Cet objet expose les méthodes suivantes :

  • add : Permet d’ajouter un média audio live au player et retourne un objet LiveAudio.
  • remove : Supprime un média audio live
  • removeAll : Supprime tous les médias audio live
 

Exemples de marquage

  1. Marquage d’une lecture de média audio live sans rafraîchissement
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		let liveAudio = player.liveAudios.add("song")
    
    		liveAudio.sendPlayWithoutRefresh()
    
    		/// with buffering (>= 2.11.0)
    		liveAudio.sendPlayWithoutRefresh(true)
    	}
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	LiveAudio *liveAudio = [self.player.liveAudios add:@"song"];
    
    	[liveAudio sendPlayWithoutRefresh];
    
    	/// with buffering (>= 2.11.0)
    	[liveAudio sendPlayWithoutRefreshWithIsBuffering:YES];
    }
    
    @end
  2. Marquage d’une lecture de média audio live avec rafraîchissement (la période de rafraîchissement ne peut pas
    être inférieure à 5s)
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		let liveAudio = player.liveAudios.add("song", mediaTheme1: "theme1")
    
    		// Refresh duration 10sec
    		liveAudio.sendPlay(10)
    
    		/// with buffering (>= 2.11.0)
    		liveAudio.sendPlay(true)
    	}
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	LiveAudio *liveAudio = [self.player.liveAudios add:@"song" mediaTheme1:@"theme1"];
    
    	// Refresh duration 10sec
    	[liveAudio sendPlay:10];
    
    	/// with buffering (>= 2.11.0)
    	[liveAudio sendPlayWithIsBuffering:YES];
    }
    
    @end
    
  3. Marquage d’une pause dans le média audio live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var liveAudio: LiveAudio!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillDisappear(animated: Bool) {
    		liveAudio.sendPause()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		liveAudio = player.videos.add("song")
    		liveAudio.sendPlay()
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) LiveAudio *liveAudio;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
    	[self.liveAudio sendPause];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.liveAudio = [self.player.liveAudios add:@"song"];
    	[self.liveAudio sendPlay];
    }
    
    @end
    
  4. Marquage d’un stop dans le média audio live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var liveAudio: LiveAudio!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillDisappear(animated: Bool) {
    		liveAudio.sendStop()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		liveAudio = player.videos.add("song")
    		liveAudio.sendPlay()
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) LiveAudio *liveAudio;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
    	[self.liveAudio sendStop];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.liveAudio = [self.player.liveAudios add:@"song"];
    	[self.liveAudio sendPlay];
    }
    
    @end
    
  5. Marquage d’information du média audio live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var liveAudio: LiveAudio!
    
    	override func viewDidLoad() {
    	    super.viewDidLoad()
    
    	    player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    	    liveAudio = player.liveAudios.add("song")
    	    liveAudio.sendPlay()
    
    	    /// >= 2.11.0
    	    liveAudio.sendInfo()
    	    /// with buffering
    	    liveAudio.sendInfo(true)
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) LiveAudio *liveAudio;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.liveAudio = [self.player.liveAudios add:@"movie"];
    	[self.liveAudio sendPlay];
    
    	/// >= 2.11.0
    	[self.liveAudio sendInfo];
    	/// with buffering
    	[self.liveAudio sendInfoWithIsBuffering:YES];
    }
    
    @end
    
  6. Marquage d’autres actions du média audio live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var liveAudio: LiveAudio!
    
    	override func viewDidLoad() {
    	    super.viewDidLoad()
    
    	    player = tracker.mediaPlayers.add()
    	}
    
    	// Custom method
    	func othersActions() {
    	    liveAudio.sendMove()
    	    /// >= 2.11.0
    	    liveAudio.sendShare()
    	    liveAudio.sendEmail()
    	    liveAudio.sendFavor()
    	    liveAudio.sendDownload()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    	    liveAudio = player.liveAudios.add("song")
    	    liveAudio.sendPlay()
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) LiveAudio *liveAudio;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    // Custom method
    - (void)othersActions {
    	[self.liveAudio sendMove];
    	/// >= 2.11.0
    	[self.liveAudio sendShare];
    	[self.liveAudio sendDownload];
    	[self.liveAudio sendFavor];
    	[self.liveAudio sendEmail];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.liveAudio = [self.player.liveAudios add:@"movie"];
    	[self.liveAudio sendPlay];
    }
    
    @end
    
 

Medium

L’objet MediaPlayer met à disposition un objet Media. Cet
objet expose les méthodes suivantes :

  • add : Permet d’ajouter un medium au player et retourne un objet
    Medium.
  • remove : Supprime un medium
  • removeAll : Supprime tous les media
 

Exemples de marquage

  1. Marquage d’une lecture de medium sans rafraîchissement
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		let medium = player.media.add("medium", mediaType: "customType", duration: 56)
    
    		medium.sendPlayWithoutRefresh()
    		medium.sendPlayWithoutRefresh(true)
    	}
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	Medium *medium = [self.player.media add:@"medium" mediaType:@"customType" duration:56];
    
    	[medium sendPlayWithoutRefresh];
    	[medium sendPlayWithoutRefreshWithIsBuffering:YES];
    }
    
    @end
  2. Marquage d’une lecture de medium avec rafraîchissement (la période de rafraîchissement ne peut pas être
    inférieure à 5s)
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		let medium = player.media.add("medium", mediaType: "customType", duration: 56)
    
    		medium.sendPlay()
    
    		/// with buffering
    		medium.sendPlay(true)
    	}
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	Medium *medium = [self.player.media add:@"medium" mediaType:@"customType" duration:56];
    
    	[medium sendPlay];
    
    	/// with buffering
    	[medium sendPlayWithIsBuffering:YES];
    }
    
    @end
    
  3. Marquage d’une pause dans le medium
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var medium: Medium!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillDisappear(animated: Bool) {
    		medium.sendPause()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		let medium = player.media.add("medium", mediaType: "customType", duration: 56)
    		medium.sendPlay()
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Medium *medium;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
    	[self.medium sendPause];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.medium = [self.player.media add:@"medium" mediaType:@"customType" duration:56];
    	[self.medium sendPlay];
    }
    
    @end
    
  4. Marquage d’un stop dans le medium
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var medium: Medium!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillDisappear(animated: Bool) {
    		medium.sendStop()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		medium = player.media.add("medium", mediaType:"customType", duration:56)
    		medium.sendPlay()
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Medium *medium;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
    	[self.medium sendStop];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.medium = [self.player.media add:@"medium" mediaType:@"customType" duration:56];
    	[self.medium sendPlay];
    }
    
    @end
    
  5. Marquage d’information du medium
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var medium: Medium!
    
    	override func viewDidLoad() {
    	    super.viewDidLoad()
    
    	    player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    	    medium = player.media.add("medium", mediaType: "customType", duration: 56)
    	    medium.sendPlay()
    
    	    medium.sendInfo()
    	    medium.sendInfo(true)
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Medium *medium;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.medium = [self.player.media add:@"movie" mediaType:@"customType" duration:56];
    	[self.medium sendPlay];
    
    	[self.medium sendInfo];
    	[self.medium sendInfoWithIsBuffering:YES];
    }
    
    @end
    
  6. Marquage d’autres actions du medium
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var medium: Medium!
    
    	override func viewDidLoad() {
    	    super.viewDidLoad()
    
    	    player = tracker.mediaPlayers.add()
    	}
    
    	// Custom method
    	func othersActions() {
    	    medium.sendMove()
    	    medium.sendShare()
    	    medium.sendEmail()
    	    medium.sendFavor()
    	    medium.sendDownload()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    	    medium = player.media.add("song", mediaType:"customType", duration:56)
    	    medium.sendPlay()
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) Medium *medium;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    // Custom method
    - (void)othersActions {
    	[self.medium sendMove];
    	/// >= 2.11.0
    	[self.medium sendShare];
    	[self.medium sendDownload];
    	[self.medium sendFavor];
    	[self.medium sendEmail];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.medium = [self.player.media add:@"movie" mediaType:@"customType" duration:56];
    	[self.medium sendPlay];
    }
    
    @end
    
 

LiveMedium

L’objet MediaPlayer met à disposition un objet LiveMedia.
Cet objet expose les méthodes suivantes :

  • add : Permet d’ajouter un medium live au player et retourne un objet Medium.
  • remove : Supprime un medium live
  • removeAll : Supprime tous les media live
 

Exemples de marquage

  1. Marquage d’une lecture de medium live sans rafraîchissement
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		let liveMedium = player.liveMedia.add("medium", mediaType: "customType")
    
    		liveMedium.sendPlayWithoutRefresh()
    		liveMedium.sendPlayWithoutRefresh(true)
    	}
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	LiveMedium *liveMedium = [self.player.liveMedia add:@"medium" mediaType:@"customType"];
    
    	[liveMedium sendPlayWithoutRefresh];
    	[liveMedium sendPlayWithoutRefreshWithIsBuffering:YES];
    }
    
    @end
  2. Marquage d’une lecture de medium live avec rafraîchissement (la période de rafraîchissement ne peut pas être
    inférieure à 5s)
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		let liveMedium = player.liveMedia.add("medium", mediaType: "customType")
    
    		liveMedium.sendPlay()
    
    		/// with buffering
    		liveMedium.sendPlay(true)
    	}
    
    }
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	LiveMedium *liveMedium = [self.player.liveMedia add:@"medium" mediaType:@"customType"];
    
    	[liveMedium sendPlay];
    
    	/// with buffering
    	[liveMedium sendPlayWithIsBuffering:YES];
    }
    
    @end
    
  3. Marquage d’une pause dans le medium live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var liveMedium: LiveMedium!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillDisappear(animated: Bool) {
    		medium.sendPause()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		let liveMedium = player.liveMedia.add("medium", mediaType: "customType")
    		liveMedium.sendPlay()
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) LiveMedium *liveMedium;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
    	[self.liveMedium sendPause];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.liveMedium = [self.player.liveMedia add:@"medium" mediaType:@"customType"];
    	[self.liveMedium sendPlay];
    }
    
    @end
    
  4. Marquage d’un stop dans le medium live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var liveMedium: LiveMedium!
    
    	override func viewDidLoad() {
    		super.viewDidLoad()
    
    		player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillDisappear(animated: Bool) {
    		liveMedium.sendStop()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    		liveMedium = player.liveMedia.add("song", mediaType:"customType")
    		liveMedium.sendPlay()
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) LiveMedium *liveMedium;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
    	[self.liveMedium sendStop];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.liveMedium = [self.player.liveMedia add:@"medium" mediaType:@"customType"];
    	[self.liveMedium sendPlay];
    }
    
    @end
    
  5. Marquage d’information du medium live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var liveMedium: LiveMedium!
    
    	override func viewDidLoad() {
    	    super.viewDidLoad()
    
    	    player = tracker.mediaPlayers.add()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    	    liveMedium = player.liveMedia.add("medium", mediaType: "customType")
    	    liveMedium.sendPlay()
    
    	    liveMedium.sendInfo()
    	    liveMedium.sendInfo(true)
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) LiveMedium *liveMedium;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.liveMedium = [self.player.liveMedia add:@"movie" mediaType:@"customType"];
    	[self.liveMedium sendPlay];
    
    	[self.liveMedium sendInfo];
    	[self.liveMedium sendInfoWithIsBuffering:YES];
    }
    
    @end
    
  6. Marquage d’autres actions du medium live
    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
    
    	let tracker = ATInternet.sharedInstance.defaultTracker
    	var player: MediaPlayer!
    	var liveMedium: LiveMedium!
    
    	override func viewDidLoad() {
    	    super.viewDidLoad()
    
    	    player = tracker.mediaPlayers.add()
    	}
    
    	// Custom method
    	func othersActions() {
    	    liveMedium.sendMove()
    	    liveMedium.sendShare()
    	    liveMedium.sendEmail()
    	    liveMedium.sendFavor()
    	    liveMedium.sendDownload()
    	}
    
    	override func viewWillAppear(animated: Bool) {
    	    liveMedium = player.liveMedia.add("medium", mediaType:"customType")
    	    liveMedium.sendPlay()
    	}
    
    }
    
    #import "ViewController.h"
    #import "SmartTracker/SmartTracker-Swift.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) Tracker *tracker;
    @property (nonatomic, strong) MediaPlayer *player;
    @property (nonatomic, strong) LiveMedium *liveMedium;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    
    	self.tracker = [[ATInternet sharedInstance] defaultTracker];
    
    	self.player = [self.tracker.mediaPlayers add];
    }
    
    // Custom method
    - (void)othersActions {
    	[self.liveMedium sendMove];
    	/// >= 2.11.0
    	[self.liveMedium sendShare];
    	[self.liveMedium sendDownload];
    	[self.liveMedium sendFavor];
    	[self.liveMedium sendEmail];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
    	self.liveMedium = [self.player.liveMedia add:@"movie" mediaType:@"customType"];
    	[self.liveMedium sendPlay];
    }
    
    @end
    
 

Gestion de la mise en cache (buffering) (>= 2.11.0)

Depuis la version 2.11.0, il est désormais possible de mesurer le temps de mise en cache (buffering) d’un média quel qu’il soit.

 

Exemples de marquage

import UIKit
import Tracker

class ViewController: UIViewController {

	let tracker = ATInternet.sharedInstance.defaultTracker
	var player: MediaPlayer!
	var liveMedium: LiveMedium!

	override func viewDidLoad() {
		super.viewDidLoad()

		player = tracker.mediaPlayers.add()
		liveMedium = player.liveMedia.add("medium", mediaType: "customType")
	}
}
#import "ViewController.h"
#import "SmartTracker/SmartTracker-Swift.h"

@interface ViewController ()

@property (nonatomic, strong) Tracker *tracker;
@property (nonatomic, strong) MediaPlayer *player;
@property (nonatomic, strong) LiveMedium *liveMedium;

@end

@implementation ViewController

- (void)viewDidLoad {
	[super viewDidLoad];

	self.tracker = [[ATInternet sharedInstance] defaultTracker];

	self.player = [self.tracker.mediaPlayers add];

	self.liveMedium = [self.player.liveMedia add:@"medium" mediaType:@"customType"];
}

@end

  1. Lancement d’une lecture sans mise en cache
    liveMedium.sendPlay()
    [self.liveMedium sendPlay];
  2. Lancement d’une lecture avec mise en cache
    liveMedium.sendPlay(true)
    [self.liveMedium sendPlayWithIsBuffering:YES];
  3. Reprise de la lecture suite à une mise en cache
    liveMedium.sendInfo(false)
    [self.liveMedium sendInfoWithIsBuffering:NO]
  4. Mise en cache pour une lecture en cours
    liveMedium.sendInfo(true)
    [self.liveMedium sendInfoWithIsBuffering:YES]
 

Propriétés communes

Nom Type Valeur par défaut Description
mediaLabel String Chaîne vide Obtient ou définit le nom du média visionné
mediaTheme1 String? nil Obtient ou définit le premier chapitre
mediaTheme2 String? nil Obtient ou définit le second chapitre
mediaTheme3 String? nil Obtient ou définit le troisième chapitre
mediaLevel2 Int 0 Obtient ou définit l’identifiant du niveau 2
isEmbedded Bool false Indique si le média est externe à l’application
webdomain String? nil Obtient ou définit le referrer du média dans le cas de contenu externe (isEmbedded à true)
linkedContent String? nil Obtient ou définit le libellé du contenu lié à une publicité (pre-roll, mid-roll ou post-roll)
 

Classe MediaPlayer

 

Propriétés

Nom Type Valeur par défaut Description
playerId Int 1 Obtient ou définit l’identifiant du player
videos Videos nil Obtient l’instance permettant de gérer les vidéos
audios Audios nil Obtient l’instance permettant de gérer les médias audio
media  (>= 2.11.0) Media nil Obtient l’instance permettant de gérer les media
liveVideos LiveVideos nil Obtient l’instance permettant de gérer les vidéos live
liveAudios LiveAudios nil Obtient l’instance permettant de gérer les médias audio live
liveMedia  (>= 2.11.0) LiveMedia nil Obtient l’instance permettant de gérer les media

La gestion de
l’identifiant du player est automatique mais vous pouvez cependant en spécifier un.

 

Classe Video

 

Propriétés

Nom Type Valeur par défaut Description
duration Int 0 Obtient ou définit la durée total de la vidéo en seconde
 

Classe Audio

 

Propriétés

Nom Type Valeur par défaut Description
duration Int 0 Obtient ou définit la durée total du média audio en seconde
 

Classe Medium

 

Propriétés

Nom Type Valeur par défaut Description
duration Int 0 Obtient ou définit la durée total du medium en seconde
 

Méthodes

Nom Type de retour Description
sendPlay() (< 2.9.0) void Envoi du hit de lecture avec un rafraîchissement automatique de 5 secondes
sendPlay() (>= 2.9.0) void Envoi du hit de lecture avec un rafraîchissement automatique défini par paliers (voir plus
haut)
sendPlay(isBuffering: Bool) (>= 2.11.0) void Envoi du hit de lecture avec un rafraîchissement automatique défini par paliers (voir plus
haut) en spécifiant s’il y a du buffering
sendPlay(refreshDuration: Int) (déprécié en version 2.9.0) void Envoi du hit de lecture avec un rafraîchissement automatique donné en paramètre (0 =
désactivation du rafraîchissement)
sendPlay(refreshDuration: Dictionary<Int, Int>) (>= 2.9.0) void Envoi du hit de lecture avec un rafraîchissement automatique en respectant les paliers définis
en paramètre
sendPlay(refreshDuration: Dictionary<Int, Int>, isBuffering: Bool) (>= 2.11.0) void Envoi du hit de lecture avec un rafraîchissement automatique en respectant les paliers définis
en paramètre en spécifiant s’il y a du buffering
sendPlayWithoutRefresh() (>= 2.9.0) void Envoi du hit de lecture sans rafraîchissement
sendPlayWithoutRefresh() (>= 2.11.0) void Envoi du hit de lecture sans rafraîchissement en spécifiant s’il y a du buffering
sendResume() (>= 2.9.0) void Reprise de la mesure de la lecture en l’état
sendResume(isBuffering: Bool) (>= 2.11.0) void Reprise de la mesure de la lecture en l’état en spécifiant s’il y a du buffering
sendPause void Envoi du hit de pause
sendStop void Envoi du hit de stop
sendInfo (>= 2.11.0) void Envoi du hit d’information
sendInfo(isBuffering: Bool) (>= 2.11.0) void Envoi du hit d’information en spécifiant s’il y a du buffering
sendMove void Envoi du hit de mouvement du curseur de lecture
sendShare (>= 2.11.0) void Envoi du hit de partage
sendEmail (>= 2.11.0) void Envoi du hit d’email
sendDownload (>= 2.11.0) void Envoi du hit de téléchargement
sendFavor (>= 2.11.0) void Envoi du hit de mise en favori
Cet article vous a-t-il été utile ?
Oui
Non
Dernière mise à jour : 21/03/2019