Skip to content

Commit

Permalink
Updates samples to call out NonceRequest parameters are examples.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 673919871
  • Loading branch information
google-ima-devrel-bot authored and IMA Developer Relations committed Sep 12, 2024
1 parent 087825e commit 5d2f3a4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ protected void onCreate(Bundle savedInstanceState) {
/**
* Makes a call to the SDK to create a nonce manager. In a typical PAL app, this would be called
* at the start of the media stream.
*
* <p>The NonceRequest parameters set here are example parameters. You should set your parameters
* based on your own app characteristics.
*/
public void generateNonceForAdRequest(View view) {
logMessage("Generate Nonce Request");
Expand All @@ -79,7 +82,7 @@ public void generateNonceForAdRequest(View view) {
.videoPlayerHeight(480)
.videoPlayerWidth(640)
.willAdAutoPlay(true)
.willAdPlayMuted(true)
.willAdPlayMuted(false)
.build();

nonceLoader
Expand Down
4 changes: 3 additions & 1 deletion cast/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
let playbackDidStart = false;

// Configures and requests the NonceManager.
// The NonceRequest parameters set here are example parameters.
// You should set your parameters based on your own app characteristics.
// @return Promise promise that resolves when nonceManager is returned
const requestNonceManager = () => {
const request = new goog.cast.pal.NonceRequest();
request.adWillAutoPlay = true;
request.adWillPlayMuted = true;
request.adWillPlayMuted = false;
request.continuousPlayback = false;
request.descriptionUrl = 'https://example.com';
request.iconsSupported = true;
Expand Down
7 changes: 5 additions & 2 deletions html5/pal_sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,19 @@ function init() {
const consentSettings = new goog.pal.ConsentSettings();
consentSettings.allowStorage = getConsentToStorage();

nonceLoader = new goog.pal.NonceLoader();
nonceLoader = new goog.pal.NonceLoader(consentSettings);
}

/**
* Generates a nonce with sample arguments and logs it to the console.
*
* The NonceRequest parameters set here are example parameters.
* You should set your parameters based on your own app characteristics.
*/
function generateNonce() {
const request = new goog.pal.NonceRequest();
request.adWillAutoPlay = true;
request.adWillPlayMuted = true;
request.adWillPlayMuted = false;
request.continuousPlayback = false;
request.descriptionUrl = 'https://example.com';
request.iconsSupported = true;
Expand Down
5 changes: 4 additions & 1 deletion ios/SimpleExample/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ - (void)viewDidLoad {

/**
* Requests a new nonce manager with a request containing arbitrary test values like a (sane) user
* might supply. Displays the nonce or error on success. This should be called once per strea
* might supply. Displays the nonce or error on success. This should be called once per stream.
*
* The PALNonceRequest parameters set here are example parameters.
* You should set your parameters based on your own app characteristics.
*/
- (IBAction)requestNonceManager {
PALNonceRequest *request = [[PALNonceRequest alloc] init];
Expand Down

0 comments on commit 5d2f3a4

Please sign in to comment.