Skip to content

Commit

Permalink
Adding Streaming Media Component to Web SDK (#1083)
Browse files Browse the repository at this point in the history
Adding support for Streaming Media  to Web SDK
  • Loading branch information
ninaceban authored May 16, 2024
1 parent 936fc1a commit bf1a329
Show file tree
Hide file tree
Showing 56 changed files with 5,101 additions and 49 deletions.
86 changes: 45 additions & 41 deletions sandbox/public/index_extension.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,81 +19,85 @@
<title>AEP Web SDK - Tags Extension</title>
<style>
body {
margin: 0 auto;
font-family: Arial, sans-serif;
width: 60%;
padding: 50px;
height: 100%;
border: 1px solid gainsboro;
margin: 0 auto;
font-family: Arial, sans-serif;
width: 60%;
padding: 50px;
height: 100%;
border: 1px solid gainsboro;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
}
.logo {
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
"Lucida Sans Unicode", Geneva, Verdana, sans-serif;
}
.nav-bar {
display: flex;
gap: 15px;
display: flex;
gap: 15px;
}
.nav-bar a {
text-decoration: none;
color: black;
text-decoration: none;
color: black;
}
.banner {
width: 100%;
height: 80px;
background-color: #f3f3f3;
text-align: center;
padding-top: 30px;
margin-bottom: 20px;
width: 100%;
height: 80px;
background-color: #f3f3f3;
text-align: center;
padding-top: 30px;
margin-bottom: 20px;
}
.buttons {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 70px;
display: flex;
justify-content: center;
gap: 10px;
margin-top: 70px;
}
.video-player {
display: flex;
justify-content: center;
margin: 20px 0;
display: flex;
justify-content: center;
margin: 20px 0;
}
button {
cursor:pointer;
cursor: pointer;
margin: 0 20px;
padding: 15px;
}
</style>

<!-- Using Unified JS LAB, property Alloyio-Tags -->
<script src="https://assets.adobedtm.com/1281f6ff0c59/6075d61c737a/launch-1d287ed0445a-development.min.js" async></script>
<script
src="https://assets.adobedtm.com/1281f6ff0c59/6075d61c737a/launch-1d287ed0445a-development.min.js"
async
></script>
</head>
<body>
<div class="header">
<h3 class="logo">Alloy</h3>
<nav class="nav-bar">
<a href="#" class="link1">Link 1</a>
<a href="#" class="link2">Link 2</a>
<a href="#" class="link3">Link 3</a>
<a href="#" class="link1">Link 1</a>
<a href="#" class="link2">Link 2</a>
<a href="#" class="link3">Link 3</a>
</nav>
</div>
<div class="banner">
Banner Content
Banner Content
</div>
<div class="video-player">
<video width="640" height="360" controls id="home-player">
<source src="video/clickbaby.mp4" type="video/mp4">
</video>
<video width="640" height="360" controls id="home-player">
<source src="video/clickbaby.mp4" type="video/mp4" />
</video>
</div>
<div class="buttons">
<button class="button1">Button 1</button>
<button class="button2">Button 2</button>
<button class="button3">Button 3</button>
<button class="button4">Button 4</button>
<button class="button1">Button 1</button>
<button class="button2">Button 2</button>
<button class="button3">Button 3</button>
<button class="button4">Button 4</button>
</div>
</body>
</html>
Binary file added sandbox/public/media-collection/clickbaby.mp4
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="stylesheet" href="/index.css" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script>

<title>Mock website hosting Alloy using launch</title>

<script
src="https://assets.adobedtm.com/1281f6ff0c59/5713085bbf10/launch-29822268cf77-development.min.js"
async
></script>
</head>

<body>
<div>
<h2>
Collect streaming media events using automatic session handling option.
</h2>
<video id="launch-media-movie" width="600" preload controls muted>
<source
src="clickbaby.mp4"
type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
/>
</video>
<h2>
Collect streaming media events using manual session handling option.
</h2>
<video id="second-launch-media-movie" width="600" preload controls muted>
<source
src="clickbaby.mp4"
type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
/>
</video>
</div>
</body>
</html>
129 changes: 129 additions & 0 deletions sandbox/public/media-collection/streaming-media.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="stylesheet" href="/index.css" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script>

<title>Mock website hosting Alloy</title>

<!-- prettier-ignore -->
<script nonce="%REACT_APP_NONCE%">
!function(e,a,n,t){var i=e.head;if(i){
if (a) return;
var o=e.createElement("style");
o.setAttribute("nonce", "%REACT_APP_NONCE%");
o.id="alloy-prehiding",o.innerText=n,i.appendChild(o),
setTimeout(function(){o.parentNode&&o.parentNode.removeChild(o)},t)}}
(document, document.location.href.indexOf("mboxEdit") !== -1, ".personalization-container { opacity: 0 !important }", 3000);
</script>

<!-- prettier-ignore -->
<script nonce="%REACT_APP_NONCE%">
!function(n,o){o.forEach(function(o){n[o]||((n.__alloyNS=n.__alloyNS||
[]).push(o),n[o]=function(){var u=arguments;return new Promise(
function(i,l){n[o].q.push([i,l,u])})},n[o].q=[])})}
(window,["alloy"]);
</script>

<script nonce="%REACT_APP_NONCE%">
function getUrlParameter(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
var results = regex.exec(location.search);
return results === null
? ""
: decodeURIComponent(results[1].replace(/\+/g, " "));
}

function includeScript(src) {
return new Promise(function(resolve, reject) {
var tag = document.createElement("script");
tag.type = "text/javascript";
tag.async = true;
tag.addEventListener("load", function() {
resolve();
});
tag.nonce = "%REACT_APP_NONCE%";
tag.src = src;
document.head.appendChild(tag);
});
}

if (getUrlParameter("includeVisitor") === "true") {
includeScript(
"https://github.com/Adobe-Marketing-Cloud/id-service/releases/download/4.5.1/visitorapi.min.js"
).then(function() {
Visitor.getInstance("53A16ACB5CC1D3760A495C99@AdobeOrg", {
doesOptInApply: getUrlParameter("legacyOptIn") === "true"
});
// Alloy only looks for window.Visitor when it initially loads, so only load Alloy after Visitor loaded.
includeScript("/alloy.js");
});
} else {
includeScript("/alloy.js");
}
</script>
<script nonce="%REACT_APP_NONCE%">
alloy("configure", {
streamingMedia: {
// adobeStreamingMedia
// need to move these at session creation command
channel: "video channel",
playerName: "ninas player",
appVersion: "alloy 2.16.0",
adPingInterval: 1,
mainPingInterval: 12
},
defaultConsent: "in",
edgeBasePath: "ee",
edgeConfigId: "27dae196-8c75-4eed-82d1-3895616f85d6",
orgId: "97D1F3F459CE0AD80A495CBE@AdobeOrg", // UnifiedJS
debugEnabled: true,
prehidingStyle: ".personalization-container { opacity: 0 !important }",
onBeforeEventSend: function(options) {
console.log("onBeforeEEveeent", options);
}
});
</script>
<script src="video-player-1.js"></script>
<script src="video-player-2.js"></script>
<script src="video-player-3.js"></script>
</head>
<body>
<div>
<h2>
Collect streaming media events using automatic session handling option.
</h2>
<video id="media-movie" width="600" preload controls muted>
<source
src="clickbaby.mp4"
type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
/>
</video>
<h2>
Collect streaming media events using manual session handling option.
</h2>
<video id="media-second-movie" width="600" preload controls muted>
<source
src="clickbaby.mp4"
type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
/>
</video>
<h2>Collect streaming media events using legacy Media Analytics API.</h2>
<video id="media-third-movie" width="600" preload controls muted>
<source
src="clickbaby.mp4"
type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
/>
</video>
</div>
<div id="root"></div>
</body>
</html>
Loading

0 comments on commit bf1a329

Please sign in to comment.