Uppod HTML5
Tuesday, March 31, 2020 5:24 AMUppod - is HTML5-Flash player with video playback and HLS support.
Supported versions of Uppod
Teleport.js is compatible with Uppod HTML5 version 0.13.03 - 0.13.05.
Required external data:
-
apikey
- before teleport.js in initialized the first time, you need to validate the domain and get the API key in Teleport user area.
Initialization
Loading javascript modules when integrating Uppod with teleport.js should occur strictly in the following order:
- Uppod.
- Teleport Core bundle with Uppod plugin.
Example:
<script type="text/javascript" src="/uppod-0.13.03.js"></script>
<script src="https://cdn.teleport.media/stable/teleport.uppod.bundle.js"></script>
To load chunks from P2P you need:
- Create the Uppod instance.
- Initialize Teleport with
Uppod
loader and params as an argument.
Example:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TELEPORT UPPOD EXAMPLE</title>
</head>
<body>
<div id="video"></div>
<!-- Include Uppod -->
<script src="/uppod-0.13.05.js"></script>
<!-- Include Teleport Core bundle with Teleport Uppod plugin -->
<script src="https://cdn.teleport.media/stable/teleport.uppod.bundle.js"></script>
<!-- Setup -->
<script>
var tlprt;
var STREAM_URL = "<MANIFEST URL>";
var API_KEY = "<YOUR APIKEY>";
function initApp() {
// Create player
var player = new Uppod({
m: "video",
uid: "video",
file: STREAM_URL
});
// Init Teleport
teleport.initialize({
apiKey: API_KEY,
loader: { // Loader configuration
type: "uppod", // Plugin ID
params: {
uppod: Uppod // Player constructor
}
}
})
.then(function (instance) {
// Save teleport instance
tlprt = instance;
console.log("The video has now been loaded!");
// Subscribe to on close window event for free used resources
window.addEventListener("unload", function () {
if (tlprt) {
tlprt.dispose();
tlprt = null;
}
});
})
.catch(onError);
}
function onError(error) {
// Log the error
console.error("Error code", error.code, "object", error);
}
document.addEventListener("DOMContentLoaded", initApp);
</script>
</body>
</html>
API
API docs could be found here.