updateOTT: Difference between revisions
From Engineering Client Portal
(Created page with "{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|iOS SDK API Reference}} {{CurrentBreadcrumb}} Category:Digital Category:iOS SDK API Reference Use <code>updateOTT<...") |
NickParrucci (talk | contribs) (→Notes) |
||
(One intermediate revision by one other user not shown) | |||
Line 4: | Line 4: | ||
Use <code>updateOTT</code> method to notify App SDK that the remote OTT device (like Google ChromeCast, Roku, Amazon FireTV, etc.) is connected / disconnected (change of OTT status). | Use <code>updateOTT</code> method to notify App SDK that the remote OTT device (like Google ChromeCast, Roku, Amazon FireTV, etc.) is connected / disconnected (change of OTT status). | ||
*When OTT device is connected, call <code>updateOTT</code> with <code>"ottStatus": "1"</code> and a set of OTT device related parameters in ottInfo dictionary. | *When OTT device is connected, call <code>updateOTT</code> with <code>"ottStatus": "1"</code> and a set of OTT device related parameters in ottInfo dictionary. | ||
*When OTT device is disconnected, call <code>updateOTT with <code>"ottStatus": "0"</code> in <code>ottInfo</code> dictionary. | *When OTT device is disconnected, call <code>updateOTT</code> with <code>"ottStatus": "0"</code> in <code>ottInfo</code> dictionary. | ||
== Syntax == | == Syntax == | ||
Line 52: | Line 52: | ||
== Notes == | == Notes == | ||
*Every time when application is launched or moving to foreground, call <code>updateOTT</code> to report the current OTT status to the App SDK. | *Every time when application is launched or moving to foreground, call <code>updateOTT</code> to report the current OTT status to the App SDK. | ||
=== Communicating with the Chromecast Receiver App === | === Communicating with the Chromecast Receiver App === |
Latest revision as of 15:23, 9 February 2023
Use updateOTT
method to notify App SDK that the remote OTT device (like Google ChromeCast, Roku, Amazon FireTV, etc.) is connected / disconnected (change of OTT status).
- When OTT device is connected, call
updateOTT
with"ottStatus": "1"
and a set of OTT device related parameters in ottInfo dictionary. - When OTT device is disconnected, call
updateOTT
with"ottStatus": "0"
inottInfo
dictionary.
Syntax
– (void)updateOTT:(id)ottInfo;
Input Parameters
Parameter | Description |
---|---|
ottInfo | A JSON string with the following parameters:
OTT device is connected NSDictionary *ottInfo = @
{
@"ottStatus": @"1",
@"ottType": @"casting",
@"ottDevice": @"chromecast",
@"ottDeviceName": @"Google ChromeCast",
@"ottDeviceID": @"xxxx-xxxx-xxxx",
@"ottDeviceManufacturer": @"Google",
@"ottDeviceModel": @"ChromeCast",
@"ottDeviceVersion": @"1.0.0"
}
OTT device is disconnected NSDictionary *ottInfo = @
{
@"ottStatus": @"0"
}
See International Metadata in International (Germany). |
Output Parameters
Parameter | Description |
---|---|
Void |
Notes
- Every time when application is launched or moving to foreground, call
updateOTT
to report the current OTT status to the App SDK.
Communicating with the Chromecast Receiver App
SDK cannot communicate directly with the Receiver App running on the Chromecast as it needs access to the Google Casting framework. Alternatively, App SDK requires the application to pass the data to the Receiver App. The application should
- Retrieve the Opt-Out status on the device (using optOutStatus) and its Demographic ID (using demographicId)
- Relay the retrieved details / values to the Receiver App, as additional parameters in
GCKMediaMetadata
payload.- Create the metadata information for this purpose, using
GCKMediaMetadata
.
- Create the metadata information for this purpose, using
The two custom parameters to be included in GCKMediaMetadata
are
kGCKMetadataNlsKeyDeviceID
for device ID.kGCKMetadataNlsKeyOptout
for Opt-out status (0 or 1).
Below is a sample code snippet on how the application should retrieve and relay the information from App SDK to Receiver App.
static NSString * const kGCKMetadataNlsKeyDeviceID = @"kGCKMetadataNlsKeyDeviceID";
static NSString * const kGCKMetadataNlsKeyOptout = @"kGCKMetadataNlsKeyOptout";
GCKMediaMetadata *metadata = [[GCKMediaMetadata alloc] init];
NSUInteger channelIndex = [self.appConfig.channels indexOfObject:self.currentChannel] + 1;
[metadata setString:[NSString stringWithFormat:@"Channel %d", channelIndex] forKey:kGCKMetadataKeyTitle];
[metadata setString:self.currentChannel.urlString forKey:kGCKMetadataKeySubtitle];
// custom parameters
[metadata setString:self.nielsenAppApi.demographicId forKey:kGCKMetadataNlsKeyDeviceID];
[metadata setString:(self.nielsenAppApi.optOutStatus ? @"1": @"0") forKey:kGCKMetadataNlsKeyOptout];
[self logConsole:[NSString stringWithFormat:@"Reporting parameters to receiver. %@: %@, %@: %@", kGCKMetadataNlsKeyDeviceID, self.nielsenAppApi.demographicId, kGCKMetadataNlsKeyOptout, (self.nielsenAppApi.optOutStatus ? @"1": @"0")]];
GCKMediaInformation *mediaInformation =
[[GCKMediaInformation alloc] initWithContentID:self.currentChannel.urlString
streamType:GCKMediaStreamTypeUnknown
contentType:@"video/mp4"
metadata:metadata
streamDuration:0
customData:nil];
[self.chromecastControlChannel loadMedia:mediaInformation autoplay:YES playPosition:0];