The Anvato Analytics Plugin for iPhone is a collection of
implementation and interface files to track both user engagement and video player statistics. Any
media player based on the standard iPhone media player object (i.e.,
MPMediaPlayerController) can use the plugin. Once deployed, it
collects statistics and delivers them to the Anvato Analytics servers.
The plug-in is very lightweight both CPU and bandwidth wise, so you will
not notice anything different about your player after it is installed.
System Requirements
- iPhone Development SDK
- Anvato Analytics Plugin for iPhone
- Anvato Analytics Account with Tracker key
Downloads
- Please contact Anvato for the Plugin for iPhone
Integration with iPhone Players
The iPhone Plugin package contains the following implementations
- AnvPlayer: The player wrapper for MPMediaPlayerController
- AnvAnalytics: The core analytics module
- AnvUtils: Utility functions
And an example video player
- SampleAnvPlayer: An example player
Fully embedding the Anvato Plugin only requires instantiating the AnvPlayer instead of the MPMediaPlayerController
API functions
-
[AnvPlayer initWithUrl:andTitle:andTrackerID:] Initializes an AnvPlayer object. This is the only valid initializer. init will not work.
- [AnvPlayer getMPMoviePlayerController] Gets the MPMoviePlayerController created by the AnvPlayer. You can add your notifications to this object.
- [AnvPlayer beginPlayback] When you are ready to play, you should use the beginPlayback function. Even though you can send the play method directly
to the object you received from getMPMoviePlayerController, it is not advised.
Code Samples
AnvPlayer component encapsulates the MPMediaPlayerController. Instantiating AnvPlayer will automatically
create MPMediaPlayerController and return the object. This must be done directly dynamically and not from the Interface Builder.
-
First create the AnvPlayer as
mPlayer = [[AnvPlayer alloc ] initWithUrl:Url andTitle:Title andTrackerID:trackerID ];
where Url is the URL of the video, Title is the title and trackerID is the tracker ID assigned to you.
-
You can then access the MPMediaPlayerController class as
MPMoviePlayerController* mp = [mPlayer getMPMoviePlayerController];
-
You will probably want to add observers, e.g.:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePreloadDidFinish:)
name:MPMoviePlayerContentPreloadDidFinishNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:mp];
-
Then start the playback as
[mPlayer beginPlayback];