Skip to content

Commit

Permalink
Added Custom Loading Page
Browse files Browse the repository at this point in the history
  • Loading branch information
elvistony committed Oct 11, 2024
1 parent 25e7602 commit 2f8940f
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 3,296 deletions.
17 changes: 15 additions & 2 deletions admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BingeBuddies | Admin Controls</title>
<title>BingeBud | Admin Controls</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<!-- <link href="https://vjs.zencdn.net/7.2.3/video-js.css" rel="stylesheet"> -->
</head>
<body>
<div class="container">
Expand All @@ -14,6 +15,8 @@ <h3>Theatre Controls</h3>
<div class="mb-3">
<label for="VideoURL" class="form-label">URL</label>
<input type="text" class="form-control" id="VideoURL" placeholder="URL">
<button class="btn btn-primary btn-sm mt-2" id="dailymotionSource">Dailymotion</button>
<button class="btn btn-primary btn-sm mt-2" id="previewSource">Preview</button>
</div>
<div class="mb-3">
<label for="VideoTitle" class="form-label">Title</label>
Expand Down Expand Up @@ -59,6 +62,16 @@ <h3>Debug</h3>

<!-- <script src="../assets/js/script.js"></script> -->
<script src="../bundle.js"></script>
<script>document.getElementById('videoplayer').volume=0.01;</script>
<script src="../assets/js/source.js"></script>
<!-- <script src="https://vjs.zencdn.net/ie8/ie8-version/videojs-ie8.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.14.1/videojs-contrib-hls.js"></script>
<script src="https://vjs.zencdn.net/7.2.3/video.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/hls.js@1"></script>
<script>document.getElementById('videoplayer').volume=0.01;
var player = videojs('videoplayer');
</script>
<script>

</script>
</body>
</html>
44 changes: 44 additions & 0 deletions assets/js/source.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
document.getElementById('dailymotionSource').addEventListener('click',()=>{
var dailymotionVideo = prompt('Enter Dailymotion URL');
var dailyID = dailymotionVideo.split('dailymotion.com/video/')[1]
const dailymotionapi = "https://corsproxy.io/?https://www.dailymotion.com/player/metadata/video/<VIDEOID>?embedder="
getText(dailymotionapi.replace('<VIDEOID>',dailyID));
async function getText(file) {
let x = await fetch(file);
let y = await x.text();
let js = await JSON.parse(y);
document.getElementById('VideoURL').value = js['qualities']['auto'][0]['url'];
}
})


function openVideoInNewTab(url) {
// Create a new window for the video
const newWindow = window.open("", "_blank");

// Create a video element in the new window
const video = document.createElement("video");
video.src = url;
video.controls = true;
video.style.width = "100%";
video.style.height = "100%";


// Create a button to close the tab
const closeButton = document.createElement("button");
closeButton.textContent = "Close Tab";
closeButton.onclick = () => {
newWindow.close();
};

// Add the video and button to the new window's body
newWindow.document.body.appendChild(video);
newWindow.document.body.appendChild(closeButton);

// Play the video automatically
video.play();
}

document.getElementById('previewSource').addEventListener('click',()=>{
openVideoInNewTab(document.getElementById('VideoURL').value);
})
Loading

0 comments on commit 2f8940f

Please sign in to comment.