-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
307 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<widget xmlns:tizen="http://tizen.org/ns/widgets" xmlns="http://www.w3.org/ns/widgets" id="http://yourdomain/BasicProject" version="1.0.0" viewmodes="maximized"> | ||
<tizen:application id="YlTERkqwPP.BasicProject" package="YlTERkqwPP" required_version="2.3"/> | ||
<content src="index.html"/> | ||
<feature name="http://tizen.org/feature/screen.size.normal.1080.1920"/> | ||
<icon src="icon.png"/> | ||
<tizen:metadata key="http://tizen.org/metadata/app_ui_type/base_screen_resolution" value="extensive"/> | ||
<name>BasicProject</name> | ||
<tizen:privilege name="http://tizen.org/privilege/internet"/> | ||
<tizen:privilege name="http://tizen.org/privilege/system"/> | ||
<tizen:privilege name="http://tizen.org/privilege/telephony"/> | ||
<tizen:privilege name='http://tizen.org/privilege/tv.inputdevice'/> | ||
<tizen:privilege name="http://developer.samsung.com/privilege/network.public"/> | ||
<tizen:privilege name="http://developer.samsung.com/privilege/productinfo"/> | ||
<tizen:profile name="tv-samsung"/> | ||
<tizen:setting screen-orientation="landscape" context-menu="enable" background-support="disable" encryption="disable" install-location="auto" hwkey-event="enable"/> | ||
<access origin="*" subdomains="true"/> | ||
</widget> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* Copyright 2024 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. */ | ||
|
||
* { | ||
font-family: Lucida Sans, Arial, Helvetica, sans-serif; | ||
} | ||
|
||
body { | ||
margin: 50px auto; | ||
background-color: #fff; | ||
} | ||
|
||
header h1 { | ||
font-size: 108px; | ||
margin: 0; | ||
} | ||
|
||
header h2 { | ||
font-size: 54px; | ||
margin: 0; | ||
color: #888; | ||
font-style: italic; | ||
} | ||
|
||
nav ul { | ||
list-style: none; | ||
padding: 20px; | ||
display: block; | ||
clear: right; | ||
background-color: #666; | ||
padding-left: 4px; | ||
height: 48px; | ||
} | ||
|
||
nav ul li { | ||
display: inline; | ||
padding: 0 20px 5px 10px; | ||
border-right: 1px solid #ccc; | ||
} | ||
|
||
nav ul li a { | ||
color: #efd3d3; | ||
text-decoration: none; | ||
font-size: 39px; | ||
font-weight: bold; | ||
} | ||
|
||
nav ul li a:hover { | ||
color: #fff; | ||
} | ||
|
||
article > header h1 { | ||
font-size: 60px; | ||
margin-left: 14px; | ||
} | ||
|
||
article > header h1 a { | ||
color: #993; | ||
} | ||
|
||
article > header h1 img { | ||
vertical-align:middle; | ||
} | ||
|
||
article > section header h1 { | ||
font-size: 48px; | ||
} | ||
|
||
article p { | ||
clear: both; | ||
} | ||
|
||
footer p { | ||
text-align: center; | ||
font-size: 36px; | ||
color: #888; | ||
margin-top: 30px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<!-- Copyright 2024 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. --> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> | ||
<meta name="description" content="Tizen basic template generated by Tizen Web IDE"/> | ||
<title>Tizen app for PAL sdk</title> | ||
<link rel="stylesheet" href="css/style.css"/> | ||
<script src="$WEBAPIS/webapis/webapis.js"></script> | ||
<script src="//imasdk.googleapis.com/pal/sdkloader/pal_ctv.js"></script> | ||
<script src="js/pal.js"></script> | ||
</head> | ||
<body> | ||
<header> | ||
<hgroup> | ||
<h1>Tizen app for PAL sdk</h1> | ||
</hgroup> | ||
</header> | ||
<div id="logOutput" style="font-size:40px;"></div> | ||
<div id="placeholder-video"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
/* | ||
Copyright 2024 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
let videoElement; | ||
let nonceLoader; | ||
let managerPromise; | ||
let nonceManager; | ||
let storageConsent = true; | ||
let playbackStarted = false; | ||
|
||
/** | ||
* A placeholder for the publisher's own method of obtaining user | ||
* consent, either by integrating with a CMP or based on other | ||
* methods the publisher chooses to handle storage consent. | ||
* @return {boolean} Whether storage consent has been given. | ||
*/ | ||
function getConsentToStorage() { | ||
return storageConsent; | ||
} | ||
|
||
/** | ||
* Initializes the PAL loader. | ||
*/ | ||
function init() { | ||
const videoElement = document.getElementById('placeholder-video'); | ||
videoElement.addEventListener('mousedown', onVideoTouch); | ||
videoElement.addEventListener('touchstart', onVideoTouch); | ||
videoElement.addEventListener('play', function() { | ||
if (!playbackStarted) { | ||
sendPlaybackStart(); | ||
playbackStarted = true; | ||
} | ||
}); | ||
videoElement.addEventListener('ended', sendPlaybackEnd); | ||
videoElement.addEventListener('error', function() { | ||
log("Video error: " + videoElement.error.message); | ||
sendPlaybackEnd(); | ||
}); | ||
|
||
document.addEventListener('keydown', function(e) { | ||
// Fake ad click, video touch, playback start and end events using remote. | ||
switch(e.keyCode) { | ||
case 37: // LEFT arrow | ||
log('sendAdClick'); | ||
sendAdClick(); | ||
break; | ||
case 38: // UP arrow | ||
log('onVideoTouch'); | ||
onVideoTouch(); | ||
break; | ||
case 39: // RIGHT arrow | ||
log('sendPlaybackStart'); | ||
sendPlaybackStart(); | ||
break; | ||
case 40: // DOWN arrow | ||
log('sendPlaybackEnd'); | ||
sendPlaybackEnd(); | ||
break; | ||
case 10009: // RETURN button | ||
tizen.application.getCurrentApplication().exit(); | ||
break; | ||
case 13: // OK button | ||
// Clear log. | ||
document.getElementById('logOutput').innerHTML = ''; | ||
break; | ||
default: | ||
log('Key code : ' + e.keyCode); | ||
break; | ||
} | ||
}); | ||
generateNonce(); | ||
} | ||
|
||
/** | ||
* Generates a nonce with sample arguments and logs it to the console. | ||
*/ | ||
function generateNonce() { | ||
// The default value for `allowStorage` is false, but can be | ||
// changed once the appropriate consent has been gathered. | ||
const consentSettings = new goog.ctv.pal.ConsentSettings(); | ||
consentSettings.allowStorage = getConsentToStorage(); | ||
nonceLoader = new goog.ctv.pal.NonceLoader(consentSettings); | ||
const request = new goog.ctv.pal.NonceRequest(); | ||
request.adWillAutoPlay = true; | ||
request.adWillPlayMuted = true; | ||
request.continuousPlayback = false; | ||
request.descriptionUrl = 'https://example.com'; | ||
request.iconsSupported = true; | ||
request.playerType = 'Sample Player Type'; | ||
request.playerVersion = '1.0'; | ||
request.ppid = 'Sample PPID'; | ||
request.sessionId = 'Sample SID'; | ||
// Player support for VPAID 2.0, OMID 1.0, and SIMID 1.1 | ||
request.supportedApiFrameworks = '2,7,9'; | ||
request.url = 'https://developers.google.com/ad-manager/pal/ctv'; | ||
request.videoHeight = 480; | ||
request.videoWidth = 640; | ||
|
||
managerPromise = nonceLoader.loadNonceManager(request); | ||
managerPromise | ||
.then(function(manager) { | ||
nonceManager = manager; | ||
log('Nonce generated: ' + manager.getNonce()); | ||
}); | ||
} | ||
|
||
/** | ||
* Informs PAL that an ad click has occurred. How this function is | ||
* called will vary depending on your ad implementation. | ||
*/ | ||
function sendAdClick() { | ||
if (nonceManager) { | ||
nonceManager.sendAdClick(); | ||
} | ||
} | ||
|
||
/** | ||
* Handles the user touching on the video element, passing it to PAL. | ||
* @param {!TouchEvent|!MouseEvent} touchEvent | ||
*/ | ||
function onVideoTouch(touchEvent) { | ||
if (nonceManager) { | ||
nonceManager.sendAdTouch(touchEvent); | ||
} | ||
} | ||
|
||
/** Informs PAL that playback has started. */ | ||
function sendPlaybackStart() { | ||
if (nonceManager) { | ||
nonceManager.sendPlaybackStart(); | ||
} | ||
} | ||
|
||
/** Informs PAL that playback has ended. */ | ||
function sendPlaybackEnd() { | ||
if (nonceManager) { | ||
nonceManager.sendPlaybackEnd(); | ||
} | ||
} | ||
|
||
/** | ||
* Outputs log. | ||
* @param {string} msg | ||
*/ | ||
function log(msg) { | ||
const logOutput = document.getElementById('logOutput'); | ||
logOutput.innerHTML = msg + '<br>' + logOutput.innerHTML; | ||
} | ||
|
||
window.addEventListener("load", function(event) { | ||
init(); | ||
}); |