The tvOS Media Player framework allows access to the native media player included with tvOS. Datazoom’s framework facilitates native tvOS applications to send video playback events based on the configuration created in data pipes.
- Login to Datazoom here: https://app.datazoom.io
- Add a Collector as indicated here: How to add a Collector
- Copy the
config key
that was created at the end of the process
Click the icon indicated below to copy the Configuration Key
You will see this message:
4. Replace the <configuration id from Datazoom>
in Datazoom's DZNativeCollector.framework
file with the Key you copied above.
5. Replace the <url given by Datazoom>
with <https://platform.datazoom.io/beacon/v1/>
6. Replace the <AVPlayer Object>
with your playerInstance
identifier
Initial setup
The DZNativeCollector.framework file should be downloaded from Here.
Drag and drop the downloaded framework file into your Xcode project. Drag the file to the files inspector on the left side of Xcode. Make sure you check the box "Copy items" in the popup menu that displays while drag and drop the file.
- Make sure that the framework added in the above step is present at the Embedded Binaries section under the General. If not present, add the framework by clicking the "+" button available at the same section
Steps for Swift Language based Applications:
After including the framework file, open the ViewController/View file, where the AVPlayer(native player) is included.
Import the framework using the following command:
import DZNativeCollector
Initialize the framework by passing along the 'Configuration ID', and player instance:
DZNativeCollector.dzSharedManager.initNativePlayerWith(configID: <configuration id from Datazoom>, url: <url given by Datazoom>, playerInstance: <AVPlayer object>)
Run the app and observe the events captured in a Connector, data corresponding to MOBILE/iPhone in Platform, refers to the events tracked from iPhone.
- To send Custom events and/or Custom metadata to Datazoom SDK we can use following methods:
DZNativeCollector.dzSharedManager.customEvents("Some custom event", metadata: "Some custom metadata")
- Change "Some custom event" and "Some custom metadata" to any text or variable you want to send to collector service.
Steps for ObjectiveC Language based Applications:
After including the framework file, Create a bridging header file, to allow interoperability of languages.
open the ViewController/View file, where the AVPlayer(native player) is included.
Import the following:
#import <AVKit/AVKit.h> #import <AVFoundation/AVFoundation.h> #import <DZNativeConnector/DZNativeConnector.h>
Initialize the swift class in the .h file.
DZNativeConnector *dzObject;
In the .m file, allocate using:
dzObject = [[DZNativeConnector alloc]init]; [dzObject initNativePlayerWithConfigId: <configuration id from Datazoom>, url: <url given by Datazoom>, playerInstance: <AVPlayer Object>];
Run the app and observe the events captured in a Connector, data corresponding to MOBILE/iPhone in Platform, refers to the events tracked from iPhone.
Demo Application
A demo application that shows the usage of this framework is available Here. This can be used to test the DZNativeConnector.Framework
Comments
0 comments
Article is closed for comments.