Files
2025-08-05 12:34:55 +00:00

73 lines
2.1 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tizen AVPlay Minimal (Official Object)</title>
<style>
html, body {
margin: 0; padding: 0;
width: 100vw; height: 100vh;
background: #000;
overflow: hidden;
}
#av-object {
position: absolute;
left: 60px;
top: 60px;
width: 800px;
height: 450px;
border: 6px solid lime;
z-index: 1000;
background: #111;
}
</style>
</head>
<body>
<div id="my-video">
<object id="av-object" type="application/avplayer"></object>
</div>
<script>
function run () {
// Координаты object элемента
var obj = document.getElementById('av-object');
var rect = obj.getBoundingClientRect();
console.log("setDisplayRect:", rect.left, rect.top, rect.width, rect.height);
// Официальный тестовый поток
var url = "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/gear1/prog_index.m3u8";
webapis.avplay.open(url);
webapis.avplay.setListener({
onbufferingstart: function() {
console.log("AVPlay: buffering start");
},
onbufferingprogress: function(percent) {
console.log("AVPlay: buffering progress", percent);
},
onbufferingcomplete: function() {
console.log("AVPlay: buffering complete");
// Важно! setDisplayRect по координатам object-а
webapis.avplay.setDisplayRect(
Math.round(rect.left),
Math.round(rect.top),
Math.round(rect.width),
Math.round(rect.height)
);
webapis.avplay.play();
},
onrenderingstart: function () {
console.log("AVPlay: video rendering started!");
},
oncurrentplaytime: function (t) {
// console.log("Current time:", t);
},
onerror: function (err) {
console.error("AVPlay error:", err);
}
});
webapis.avplay.prepareAsync();
};
run();
</script>
</body>
</html>