2
Are you saying that "Sambaplayer" is not set.
<script>
var xmlhttp = new XMLHttpRequest();
var url = "https://api.sambavideos.sambatech.com/v1/medias?access_token=847584758475847874858363&pid=3434&sort=DESC&limit=5&filter=id,title,status,qualifier,description,shortDescription,categoryName,files,thumbs";
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
myFunction(xmlhttp.responseText);
}
};
xmlhttp.open("GET", url, true);
xmlhttp.send();
myFunction(url);
function myFunction(response) {
var arr = JSON.parse(JSON.stringify(response));
var i;
var out = "<div>";
for(i = 0; i < arr.length; i++) {
out += "<a href='#' class='samba-playlist-trigger list-group-item active' data-mediaid=" + arr[i].id + "></a>";
}
out += "</div>";
document.getElementById("id01").innerHTML = out;
}
</script>
<script>// <![CDATA[
var player = new SambaPlayer("player", {
height: 270,
width: 480,
playlist: playlistObj,
playerParams: {
volume: 0,
startOutput: '480p',
html5: true
},
events: {
"*": "eventListener"
}
});
// ]]></script>
<script>// <![CDATA[
function eventListener(player){
}
function onClick(mediaId, evt){
document.getElementsByClassName('samba-playlist-trigger list-group-item active')[0].className = 'samba-playlist-trigger list-group-item';
evt.target.className = "samba-playlist-trigger list-group-item active";
}
// ]]></script>
The html of the display page
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="container">
<div class="row">
<div id="id01"></div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- chamada dos vídeos -->
<script type="text/javascript" samba-player-api="player" src="http://player.sambatech.com.br/v3/samba.player.api.js"></script>
</body>
</html>
Hello, welcome to Stackoverflow! It seems to me an error in the library import. Could you kindly provide the HTML code of the file in which you import the Javascript dependencies?
– Bonifacio
Thank you, Bonifácio. I completed the html code with the so-called Javascripts as you requested.
– Vandré Paulo
Take a look here: Samba Player API
– Douglas Garrido