Integrating the plugin with AVPlayer is done by linking SenseKit framework to your player. Here we describe how to integrate your player with SenseKit.
- A valid Sense CID
First we need to download SenseKit:
https://agent.nexeven.io/current/ios-avplayer/avplayer-sense-agent.framework.zip
After you download SenseKit extract it somewhere. It will look like this:
Move the SenseKit.framework
file equivalent to your platform (iOS, Mac, tvOS) to your application's directory. In our example we moved it to the Frameworks
directory next to our Xcode project, but you can move it anywhere you want.
Now you just need to drag and drop SenseKit.framework
into the Embedded Binaries section in your target configuration.
Now just import the framework and configure the plugin using your instance of AVPlayer
and your info.
@import SenseKit;
...
NECustomMetadata *assetMetadata = [NECustomMetadata alloc];
assetMetadata.key = @"AMK1";
assetMetadata.values = @[@"AMV1", @"AMV11"];
NECustomMetadata *viewerMetadata = [NECustomMetadata alloc];
viewerMetadata.key = @"CMK1";
viewerMetadata.values = @[@"CMV1", @"CMV11"];
NESenseAgent *agent = [[NESenseAgent alloc] initWithAVPlayer:player // your AVPlayer instance
assetId:assetId
serverHost:@"https://sense.nexeven.io"
nxeCID:@"BBQCID"
assetType:assetType
assetName:assetName
viewerId:@"jorgenS"
assetMetadata:@[assetMetadata]
viewerMetadata:@[viewerMetadata]];
import SenseKit
...
let assetMetadata = CustomMetadata()
assetMetadata.key = "AMK1"
assetMetadata.values = ["AMV1", "AMV11"]
let viewerMetadata = CustomMetadata()
viewerMetadata.key = "CMK1"
viewerMetadata.values = ["CMV1", "CMV11"]
let agent = SenseAgent(
player: player, // your AVPlayer instance
assetId: assetId,
nxeCID: "BBQCID",
assetType: assetType,
assetName: assetName,
viewerId: "jorgenS",
assetMetadata: [assetMetadata],
viewerMetadata: [viewerMetadata]
)