Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Oppla TV</title>
- <script src="https://code.jquery.com/jquery-3.3.1.min.js"
- integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
- integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
- crossorigin="anonymous"></script>
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
- integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
- <script src="https://cdn.jsdelivr.net/bluebird/3.5.0/bluebird.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.js"></script>
- <script type="text/javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script>
- <script type="text/javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
- <script type="text/javascript" src="$MANAGER_WIDGET/Common/af/2.0.0/loader.js"></script>
- <script type="text/javascript" src="JavaScript/Main.js"></script>
- <script >
- var ip = null
- var BASE_LINK = "http://minegiammi.altervista.org/oppla_script/checkStreamingLinkToTV.php";
- var connected = false;
- var public_ip = null;
- var check_interval = null
- var link = null;
- var interval_sec = 500;
- var Main = { // Main object
- }
- try {
- var widgetAPI = new Common.API.Widget(); // Creates Common module
- var tvKey = new Common.API.TVKeyValue();
- } catch (e) {
- console.error(e);
- }
- Main.onLoad = function () { // called by body's onload event
- try {
- sf.service.VideoPlayer.init({
- onstatechange: function (state) {
- //alert('Current State : ' + state);
- },
- onend: function () {
- returnToMainScreen()
- },
- onerror: function (error) {
- returnToMainScreen()
- }
- });
- sf.service.VideoPlayer.setFullScreen(true);
- sf.service.VideoPlayer.setPosition({
- left: 0,
- top: 0,
- width: 960,
- height: 540
- });
- sf.service.VideoPlayer.hide();
- sf.service.VideoPlayer.setKeyHandler(sf.key.RETURN, function () {
- sf.service.VideoPlayer.stop();
- returnToMainScreen()
- });
- widgetAPI.sendReadyEvent(); // Sends ready message to Application Manager
- } catch (e) {
- console.error(e);
- }
- setSize();
- showLoadingPage()
- $.getJSON('http://ipinfo.io', function (data) {
- public_ip = data["ip"];
- //public_ip = public_ip.replace(/\./g, "");
- sendReadyState();
- check_interval = setInterval(check_if_link_ready, interval_sec)
- });
- }
- function returnToMainScreen() {
- showLoadingPage();
- link = null;
- sendReadyState();
- check_interval = setInterval(check_if_link_ready, interval_sec)
- }
- function sendReadyState() {
- fetch(BASE_LINK + "?type=ready&ip=" + public_ip, {
- method: "GET"
- })
- .then(function (data) { return data.text() })
- .then(function (html) {
- //console.log(html);
- })
- .catch(function (e) {
- console.error(e)
- })
- }
- function closeConnection() {
- fetch(BASE_LINK + "?type=close&ip=" + public_ip, {
- method: "GET"
- })
- .then(function (data) { return data.text() })
- .then(function (html) {
- //console.log(html);
- })
- }
- Main.enableKeys = function () {
- document.getElementById("anchor").focus();
- }
- Main.keyDown = function () { // Key handler
- var keyCode = event.keyCode;
- switch (keyCode) {
- case tvKey.KEY_PAUSE:
- $('#video').trigger('pause');
- break;
- case tvKey.KEY_PLAY:
- $('#video').trigger('play');
- break;
- case tvKey.KEY_FF:
- // fast forward
- $('#video').prop("currentTime", $('#video').prop("currentTime") + 5);
- break;
- case tvKey.KEY_RW:
- // rewind
- $('#video').prop("currentTime", $('#video').prop("currentTime") - 5);
- break;
- case KEY_MUTE:
- $('#video').prop("muted", !$('#video').prop("muted"));
- break;
- case KEY_WHEELUP:
- //$('#video').prop("muted", !$('#video').prop("muted"));
- $("#video").prop("volume", $("#video").prop("volume") + 0.1);
- break;
- case KEY_WHEELDOWN:
- //$('#video').prop("muted", !$('#video').prop("muted"));
- $("#video").prop("volume", $("#video").prop("volume") - 0.1);
- break;
- case KEY_ENTER:
- document.getElementById("video").focus();
- break;
- }
- }
- Main.onUnload = function () {
- closeConnection();
- }
- function setSize() {
- var height = 540;
- var width = 960;
- $("#container").css("height", height + "px");
- $("#container").css("width", width + "px");
- $("#loading-area").css("margin-top", (height / 2 - ($("#loading").width() + 40 + 4)) + "px");
- }
- window.onresize = function () {
- setSize()
- }
- function openFullscreen() {
- var elem = document.getElementById("video");
- if (elem.requestFullscreen) {
- elem.requestFullscreen();
- } else if (elem.mozRequestFullScreen) { /* Firefox */
- elem.mozRequestFullScreen();
- } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
- elem.webkitRequestFullscreen();
- } else if (elem.msRequestFullscreen) { /* IE/Edge */
- elem.msRequestFullscreen();
- }
- }
- function closeFullscreen() {
- if (document.exitFullscreen) {
- document.exitFullscreen();
- } else if (document.mozCancelFullScreen) { /* Firefox */
- document.mozCancelFullScreen();
- } else if (document.webkitExitFullscreen) { /* Chrome, Safari and Opera */
- document.webkitExitFullscreen();
- } else if (document.msExitFullscreen) { /* IE/Edge */
- document.msExitFullscreen();
- }
- }
- function check_if_link_ready() {
- if (link != null) {
- clearInterval(check_interval)
- } else {
- //console.log(BASE_LINK + "?type=read&ip=" + public_ip);
- fetch(BASE_LINK + "?type=read&ip=" + public_ip, {
- method: "GET",
- headers: {
- }
- })
- .then(function (data) { return data.text() })
- .then(function (html) {
- link = null;
- if (html != "error" && html != "" && html != "ready" && html != null) {
- console.log(html);
- link = html;
- playVideo(link);
- }
- })
- }
- }
- function playVideo(link) {
- $("#message").html("QUASI PRONTO DAMMI UN SECONDO E CI SONO!");
- try {
- sf.service.VideoPlayer.show();
- sf.service.VideoPlayer.play({
- url: link,
- fullScreen: true
- });
- } catch (e) {
- console.error(e)
- }
- $('#video').prop("src", link);
- $('#video').prop("muted", false);
- $('#video').trigger('play')
- $('#video').on("loadeddata", function () {
- showVideoPage();
- document.getElementById("video").focus();
- //openFullscreen();
- })
- }
- function showVideoPage() {
- // SHOW VIDEO AND HIDE LOADIND
- $("#message").html("UFFF DAI CHE VOGLIO GUARDARE IL FILM");
- $("#container").css("display", "none");
- $("#video").css("display", "");
- }
- function showLoadingPage() {
- // SHOW VIDEO AND HIDE LOADIND
- try {
- sf.service.VideoPlayer.hide();
- } catch (e) {
- console.error(e)
- }
- $("#message").html("UFFF DAI CHE VOGLIO GUARDARE IL FILM");
- $("#video").css("display", "none");
- $("#container").css("display", "");
- }
- function searchRedirect(link) {
- try {
- var http = new XMLHttpRequest();
- http.open('HEAD', link);
- http.onreadystatechange = function () {
- if (this.readyState === this.DONE) {
- var new_link = this.responseURL;
- if(new_link != null) link = new_link;
- console.log("LINK : " + link);
- playVideo(link);
- }
- };
- http.send();
- } catch (e) {
- console.error(e);
- playVideo(link);
- }
- }
- </script>
- <link rel="stylesheet" type="text/css" href="CSS/Main.css" />
- </head>
- <body onload="Main.onLoad();" onunload="Main.onUnload()" onkeydown="Main.keyDown();"
- style="background-color: #171D22; color: white; font-family: calibri ">
- <div class="container-fluid" id="container" style="border: 1px transparent solid;">
- <div id="loading-area" style="display: ''">
- <div class="mb-4" style="text-align: center">
- <div id="message" class="" style="font-size: 40px; font-weight:400">
- UFFF DAI CHE VOGLIO GUARDARE IL FILM
- </div>
- </div>
- <div class="" style="text-align: center">
- <div class="spinner-border text-light" id="loading" role="status" style="width: 4rem; height: 4rem;">
- <span class="sr-only">Loading...</span>
- </div>
- </div>
- </div>
- </div>
- <video id="video" src="" controls style="display: none"></video>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement