mirror of
https://github.com/A-Star100/simpliplay-desktop.git
synced 2025-09-17 22:29:38 +00:00
Add files via upload
This commit is contained in:
parent
f12ac69878
commit
739e437d03
3
simpliplay-legacy/CONTRIBUTING.md
Normal file
3
simpliplay-legacy/CONTRIBUTING.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Contributing
|
||||
To contribute to the SimpliPlay desktop project, simply fork the repository, make your changes, and make a pull request to whichever branch you changed.
|
||||
Your pull request may take a while to be accepted, but once accepted, a new release for the app will be created and all users will be shipped with said release.
|
21
simpliplay-legacy/LICENSE
Normal file
21
simpliplay-legacy/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Anirudh Sevugan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
200214
simpliplay-legacy/LICENSES.chromium.html
Normal file
200214
simpliplay-legacy/LICENSES.chromium.html
Normal file
File diff suppressed because it is too large
Load Diff
14
simpliplay-legacy/README.md
Normal file
14
simpliplay-legacy/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# simpliplay-desktop
|
||||
The desktop version of SimpliPlay.
|
||||
|
||||
## simpliplay-nwjs
|
||||
[NW.js](https://nwjs.io) version of SimpliPlay for Windows, macOS, and Linux (x64 and ARM64).
|
||||
> [!WARNING]
|
||||
> This version is an example NW.js configuration, it won't be used in production, but you can use it if you would like. Files in this version won't be updated, so refer to files from the Electron release for production usage.
|
||||
|
||||
___
|
||||
|
||||
## Setup
|
||||
Read the docs: [NW.js - Getting Started (For Users)](https://nwjs.readthedocs.io/en/latest/For%20Users/Getting%20Started/#write-nwjs-app))
|
||||
|
||||
|
24887
simpliplay-legacy/credits.html
Normal file
24887
simpliplay-legacy/credits.html
Normal file
File diff suppressed because it is too large
Load Diff
20
simpliplay-legacy/nwjs-mit
Normal file
20
simpliplay-legacy/nwjs-mit
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright (c) 2011-2019 NW.js Authors
|
||||
Copyright (c) 2011-2019 The Chromium Authors
|
||||
Copyright (c) 2011-2018 Intel Corp
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR
|
||||
A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
6
simpliplay-legacy/package.json
Normal file
6
simpliplay-legacy/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "SimpliPlay",
|
||||
"main": "./src/index.html",
|
||||
"nodejs": false
|
||||
}
|
||||
|
1
simpliplay-legacy/src/README.txt
Normal file
1
simpliplay-legacy/src/README.txt
Normal file
@ -0,0 +1 @@
|
||||
|
17
simpliplay-legacy/src/credits.html
Normal file
17
simpliplay-legacy/src/credits.html
Normal file
@ -0,0 +1,17 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Credits</title>
|
||||
</head>
|
||||
<body>
|
||||
This is sample credits page.
|
||||
|
||||
To get correct credits page, set `generate_about_credits=true` in args.gn.
|
||||
|
||||
<!-- credits.js tries to access $('print-link').hidden and .onclick -->
|
||||
<a id="print-link" href="#" hidden>Print</a>
|
||||
|
||||
<!-- browser_tests checks "webkit" in this page -->
|
||||
Layout tests are based on layout tests from webkit.org.
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
simpliplay-legacy/src/fonts/Inter_18pt-Regular.ttf
Normal file
BIN
simpliplay-legacy/src/fonts/Inter_18pt-Regular.ttf
Normal file
Binary file not shown.
BIN
simpliplay-legacy/src/fonts/Inter_24pt-Bold.ttf
Normal file
BIN
simpliplay-legacy/src/fonts/Inter_24pt-Bold.ttf
Normal file
Binary file not shown.
2
simpliplay-legacy/src/fonts/README.md
Normal file
2
simpliplay-legacy/src/fonts/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# fonts
|
||||
folder for custom fonts
|
BIN
simpliplay-legacy/src/icon.ico
Normal file
BIN
simpliplay-legacy/src/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 272 KiB |
99
simpliplay-legacy/src/index.html
Normal file
99
simpliplay-legacy/src/index.html
Normal file
@ -0,0 +1,99 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<script src="player.js"></script>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="Content-Security-Policy" content="
|
||||
default-src 'self';
|
||||
script-src 'self';
|
||||
style-src 'self';
|
||||
img-src 'self' data:;
|
||||
media-src * blob: file:;
|
||||
connect-src *;
|
||||
font-src 'self';
|
||||
object-src 'none';
|
||||
child-src 'none';
|
||||
form-action 'self';
|
||||
worker-src 'self' blob:;
|
||||
">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="images/favicon.ico">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<!--<script src="lib/dash.js"></script>
|
||||
<script src="lib/hls.js"></script>-->
|
||||
<title>SimpliPlay</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>SimpliPlay</h1>
|
||||
<div class="dialog-overlay" id="dialogOverlay">
|
||||
<div class="dialog">
|
||||
<p>Select how you want to load media:</p>
|
||||
<button id="chooseFileBtn">Choose a File</button>
|
||||
<button id="enterUrlBtn">Enter a URL</button>
|
||||
<button id="hideDialogBtn">Go back</button>
|
||||
<input type="file" id="fileInput" accept="video/*,audio/*">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog-overlay" id="urlDialogOverlay">
|
||||
<div class="dialog">
|
||||
<p>Enter media URL:</p>
|
||||
<input type="url" id="urlInput" placeholder="Enter media URL here">
|
||||
<button id="submitUrlBtn">Submit</button>
|
||||
<button id="cancelUrlBtn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="subtitles-overlay" id="subtitlesOverlay">
|
||||
<div class="subtitles-dialog">
|
||||
<p>Enter subtitles URL:</p>
|
||||
<input type="url" id="subtitlesInput" placeholder="Enter subtitles URL here">
|
||||
<button id="submitSubtitlesBtn">Submit</button>
|
||||
<button id="cancelSubtitlesBtn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<video id="mediaPlayer" autoplay controls></video>
|
||||
|
||||
<div id="customControls">
|
||||
<button id="playPauseBtn">Pause</button>
|
||||
<div class="w-gap"></div>
|
||||
<input type="range" id="seekBar" min="0" value="0" step="0.1">
|
||||
<div class="w-gap"></div>
|
||||
<!--<span id="timeDisplay">00:00 / 00:00</span>-->
|
||||
<button id="volumeBtn">🔊</button>
|
||||
<div class="w-gap"></div>
|
||||
<input type="range" id="volumeBar" min="0" max="1" step="0.1" value="1">
|
||||
<!--<button id="fullscreenBtn">⛶</button>-->
|
||||
<div class="w-gap"></div>
|
||||
<button id="ccBtn">Add Subtitles</button> <!-- CC button -->
|
||||
</div>
|
||||
|
||||
<div class="gap-box"></div>
|
||||
<button id="showDialogBtn">Play more media</button>
|
||||
|
||||
<!-- Settings gear button -->
|
||||
<button id="settingsBtn">🛠</button>
|
||||
|
||||
<!-- Settings panel -->
|
||||
<div class="dialog-overlay" id="settingsDialogOverlay">
|
||||
<div id="settingsPanel">
|
||||
<label for="autoplayCheckbox">Autoplay:</label>
|
||||
<input type="checkbox" id="autoplayCheckbox" checked><br>
|
||||
<label for="loopCheckbox">Loop:</label>
|
||||
<input type="checkbox" id="loopCheckbox"><br>
|
||||
<label for="controlsCheckbox">Controls:</label>
|
||||
<input type="checkbox" id="controlsCheckbox" checked><br>
|
||||
<label for="controlsCheckbox" id="colorsLabel">Vivid Colors:</label>
|
||||
<input type="checkbox" id="colorsCheckbox"><br>
|
||||
<p class="settings-info"><em>Settings apply for this session only.</em></p>
|
||||
<button id="saveSettingsBtn">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
<!--<script src="./renderer.js"></script>-->
|
||||
</body>
|
||||
|
||||
</html>
|
92
simpliplay-legacy/src/licenses/Inter-font-LICENSE.txt
Normal file
92
simpliplay-legacy/src/licenses/Inter-font-LICENSE.txt
Normal file
@ -0,0 +1,92 @@
|
||||
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION AND CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
5
simpliplay-legacy/src/package.json
Normal file
5
simpliplay-legacy/src/package.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "SimpliPlay",
|
||||
"main": "index.html"
|
||||
}
|
||||
|
382
simpliplay-legacy/src/player.js
Normal file
382
simpliplay-legacy/src/player.js
Normal file
@ -0,0 +1,382 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
const dialogOverlay = document.getElementById('dialogOverlay');
|
||||
const chooseFileBtn = document.getElementById('chooseFileBtn');
|
||||
const enterUrlBtn = document.getElementById('enterUrlBtn');
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
const mediaPlayer = document.getElementById('mediaPlayer');
|
||||
const playPauseBtn = document.getElementById('playPauseBtn');
|
||||
const seekBar = document.getElementById('seekBar');
|
||||
const timeDisplay = document.getElementById('timeDisplay');
|
||||
const volumeBar = document.getElementById('volumeBar');
|
||||
const settingsBtn = document.getElementById('settingsBtn');
|
||||
const settingsPanel = document.getElementById('settingsPanel');
|
||||
const autoplayCheckbox = document.getElementById('autoplayCheckbox');
|
||||
const loopCheckbox = document.getElementById('loopCheckbox');
|
||||
const saveSettingsBtn = document.getElementById('saveSettingsBtn');
|
||||
const urlDialogOverlay = document.getElementById('urlDialogOverlay');
|
||||
const settingsDialogOverlay = document.getElementById('settingsDialogOverlay');
|
||||
const urlInput = document.getElementById('urlInput');
|
||||
const submitUrlBtn = document.getElementById('submitUrlBtn');
|
||||
const cancelUrlBtn = document.getElementById('cancelUrlBtn');
|
||||
const ccBtn = document.getElementById('ccBtn'); // CC button
|
||||
const volumeBtn = document.getElementById("volumeBtn")
|
||||
const subtitlesOverlay = document.getElementById('subtitlesOverlay');
|
||||
const subtitlesInput = document.getElementById('subtitlesInput');
|
||||
const submitSubtitlesBtn = document.getElementById('submitSubtitlesBtn');
|
||||
const cancelSubtitlesBtn = document.getElementById('cancelSubtitlesBtn');
|
||||
const customControls = document.getElementById('customControls');
|
||||
/*let hls = null
|
||||
let player = null*/
|
||||
|
||||
// Update media volume when the slider is moved
|
||||
volumeBar.addEventListener("input", function () {
|
||||
mediaPlayer.volume = volumeBar.value;
|
||||
});
|
||||
|
||||
// Sync slider with media volume (in case it's changed programmatically)
|
||||
mediaPlayer.addEventListener("volumechange", function () {
|
||||
volumeBar.value = mediaPlayer.volume;
|
||||
if (mediaPlayer.muted || mediaPlayer.volume === 0) {
|
||||
volumeBtn.textContent = "🔇";
|
||||
} else {
|
||||
volumeBtn.textContent = "🔊";
|
||||
}
|
||||
});
|
||||
|
||||
// Function to add subtitles dynamically (e.g., after URL input)
|
||||
function addSubtitles(url) {
|
||||
// Remove any existing subtitle tracks
|
||||
const existingTracks = mediaPlayer.getElementsByTagName('track');
|
||||
for (let track of existingTracks) {
|
||||
track.remove();
|
||||
}
|
||||
|
||||
// Create a new track for subtitles
|
||||
const track = document.createElement('track');
|
||||
track.kind = 'subtitles';
|
||||
track.label = 'English';
|
||||
track.srclang = 'en';
|
||||
track.src = url;
|
||||
|
||||
// Append the new track
|
||||
mediaPlayer.appendChild(track);
|
||||
|
||||
// Optionally, enable subtitles by default
|
||||
track.track.mode = 'showing'; // Enable subtitles by default
|
||||
}
|
||||
|
||||
// Handle submit subtitle URL
|
||||
function clearSubtitles() {
|
||||
const tracks = mediaPlayer.getElementsByTagName('track');
|
||||
for (let i = tracks.length - 1; i >= 0; i--) {
|
||||
tracks[i].remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Use this function when a new video is loaded
|
||||
|
||||
submitSubtitlesBtn.addEventListener('click', () => {
|
||||
const subtitleUrl = subtitlesInput.value;
|
||||
if (subtitleUrl) {
|
||||
addSubtitles(subtitleUrl);
|
||||
subtitlesOverlay.style.display = 'none';
|
||||
subtitlesInput.value = '';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
let autoplayEnabled = true;
|
||||
let loopEnabled = false;
|
||||
|
||||
// Handle submit URL button in custom dialog
|
||||
submitUrlBtn.addEventListener('click', () => {
|
||||
let url = urlInput.value;
|
||||
|
||||
// Check if URL is a valid URL and doesn't contain "http" or "https"
|
||||
if (url && !url.startsWith('http') && !url.startsWith('https')) {
|
||||
// Assuming it's a URL and needs the protocol added
|
||||
url = 'http://' + url; // You can also choose 'https://' if preferred
|
||||
}
|
||||
|
||||
|
||||
if (url) {
|
||||
clearSubtitles();
|
||||
/*if (hls !== null) {
|
||||
hls.destroy()
|
||||
hls = null
|
||||
}
|
||||
if (player !== null) {
|
||||
player.reset()
|
||||
player = null
|
||||
}*/
|
||||
if (url.toLowerCase().endsWith('.m3u8') || url.toLowerCase().endsWith('.m3u')) {
|
||||
// HLS stream
|
||||
/*if (Hls.isSupported()) {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
hls = new Hls();
|
||||
mediaPlayer.pause();
|
||||
hls.loadSource(url);
|
||||
hls.attachMedia(mediaPlayer);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function() {
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
urlInput.value = "";
|
||||
customControls.style.display = 'flex';
|
||||
});
|
||||
} else {
|
||||
alert("Your device doesn't support HLS.");
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
}*/
|
||||
alert("This type of stream is not supported in SimpliPlay Legacy. Please load a supported stream or use the main version of SimpliPlay desktop.")
|
||||
} else if (url.toLowerCase().endsWith('.mpd')) {
|
||||
/*mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
mediaPlayer.pause();
|
||||
player = dashjs.MediaPlayer().create();
|
||||
// MPEG-DASH stream
|
||||
player.initialize(mediaPlayer, url, true);
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}*/
|
||||
alert("This type of stream is not supported in SimpliPlay Legacy. Please load a supported stream or use the main version of SimpliPlay desktop.")
|
||||
} else {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
mediaPlayer.pause();
|
||||
mediaPlayer.src = url;
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
}
|
||||
urlDialogOverlay.style.display = 'none';
|
||||
dialogOverlay.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Handle CC button to show subtitle modal
|
||||
ccBtn.addEventListener('click', () => {
|
||||
subtitlesOverlay.style.display = 'block';
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Handle cancel subtitle modal
|
||||
cancelSubtitlesBtn.addEventListener('click', () => {
|
||||
subtitlesOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
|
||||
// Show the dialog on page load
|
||||
window.onload = function () {
|
||||
dialogOverlay.style.display = 'block';
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Handle "Choose a File" button
|
||||
chooseFileBtn.addEventListener('click', () => {
|
||||
fileInput.click();
|
||||
});
|
||||
|
||||
mediaPlayer.addEventListener("volumechange", function () {
|
||||
if (mediaPlayer.muted) {
|
||||
volumeBtn.textContent = "🔇"
|
||||
} else if (mediaPlayer.volume === 0) {
|
||||
volumeBtn.textContent = "🔊"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
let previousObjectURL = null; // Store the last Object URL
|
||||
|
||||
fileInput.addEventListener('change', (event) => {
|
||||
/*if (hls !== null) {
|
||||
hls.destroy()
|
||||
hls = null
|
||||
}
|
||||
if (player !== null) {
|
||||
player.reset()
|
||||
player = null
|
||||
}*/
|
||||
const file = event.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
clearSubtitles(); // Remove any previously loaded subtitles
|
||||
|
||||
// Revoke the previous Object URL if it exists
|
||||
if (previousObjectURL) {
|
||||
URL.revokeObjectURL(previousObjectURL);
|
||||
}
|
||||
|
||||
// Create a new Object URL for the selected file
|
||||
const fileURL = URL.createObjectURL(file);
|
||||
mediaPlayer.src = fileURL;
|
||||
mediaPlayer.load();
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
|
||||
// Store the new Object URL for future cleanup
|
||||
previousObjectURL = fileURL;
|
||||
|
||||
// Hide dialog after selecting a file
|
||||
dialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
|
||||
// Handle "Enter a URL" button
|
||||
enterUrlBtn.addEventListener('click', () => {
|
||||
urlDialogOverlay.style.display = 'block';
|
||||
});
|
||||
|
||||
// Handle cancel button in URL dialog
|
||||
cancelUrlBtn.addEventListener('click', () => {
|
||||
urlDialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
// Handle custom play/pause button
|
||||
playPauseBtn.addEventListener('click', () => {
|
||||
if (mediaPlayer.paused) {
|
||||
mediaPlayer.play();
|
||||
playPauseBtn.textContent = 'Pause';
|
||||
} else {
|
||||
mediaPlayer.pause();
|
||||
playPauseBtn.textContent = 'Play';
|
||||
}
|
||||
});
|
||||
|
||||
// Sync button with the video player when it is paused manually
|
||||
mediaPlayer.addEventListener('pause', () => {
|
||||
playPauseBtn.textContent = 'Play';
|
||||
});
|
||||
|
||||
// Sync button with the video player when it is played
|
||||
mediaPlayer.addEventListener('play', () => {
|
||||
playPauseBtn.textContent = 'Pause';
|
||||
});
|
||||
|
||||
// Volume button toggling mute/unmute
|
||||
volumeBtn.addEventListener('click', () => {
|
||||
if (mediaPlayer.muted || mediaPlayer.volume == 0) {
|
||||
mediaPlayer.muted = false;
|
||||
volumeBtn.textContent = '🔊'; // Unmute icon
|
||||
} else {
|
||||
mediaPlayer.muted = true;
|
||||
volumeBtn.textContent = '🔇'; // Mute icon
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Handle URL input on Enter key
|
||||
urlInput.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
submitUrlBtn.click();
|
||||
}
|
||||
});
|
||||
|
||||
// Handle Subtitles input on Enter key
|
||||
subtitlesInput.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
submitSubtitlesBtn.click();
|
||||
}
|
||||
});
|
||||
|
||||
// Handle URL submission
|
||||
|
||||
|
||||
// Update seek bar and time display
|
||||
mediaPlayer.addEventListener('timeupdate', () => {
|
||||
seekBar.max = mediaPlayer.duration || 0;
|
||||
seekBar.value = mediaPlayer.currentTime;
|
||||
const current = formatTime(mediaPlayer.currentTime);
|
||||
const total = formatTime(mediaPlayer.duration);
|
||||
timeDisplay.textContent = `${current} / ${total}`;
|
||||
});
|
||||
|
||||
// Seek media
|
||||
seekBar.addEventListener('input', () => {
|
||||
mediaPlayer.currentTime = seekBar.value;
|
||||
});
|
||||
|
||||
// Handle volume
|
||||
volumeBar.addEventListener('input', () => {
|
||||
mediaPlayer.volume = volumeBar.value;
|
||||
if (volumeBar.value == 0 || mediaPlayer.volume == 0) {
|
||||
volumeBtn.textContent = "🔇";
|
||||
} else {
|
||||
volumeBtn.textContent = "🔊";
|
||||
}
|
||||
});
|
||||
|
||||
// Show settings panel
|
||||
settingsBtn.addEventListener('click', () => {
|
||||
settingsDialogOverlay.style.display = 'block';
|
||||
settingsPanel.style.display = 'block';
|
||||
});
|
||||
|
||||
saveSettingsBtn.addEventListener('click', () => {
|
||||
autoplayEnabled = autoplayCheckbox.checked;
|
||||
loopEnabled = loopCheckbox.checked;
|
||||
mediaPlayer.autoplay = autoplayEnabled;
|
||||
mediaPlayer.loop = loopEnabled;
|
||||
|
||||
const controlsEnabled = document.getElementById('controlsCheckbox').checked;
|
||||
const colorsEnabled = document.getElementById('colorsCheckbox').checked;
|
||||
mediaPlayer.controls = controlsEnabled;
|
||||
if (colorsEnabled) {
|
||||
mediaPlayer.style.filter = "contrast(1.1) saturate(1.15) brightness(1.03)";
|
||||
} else {
|
||||
mediaPlayer.style.filter = "";
|
||||
}
|
||||
|
||||
settingsPanel.style.display = 'none';
|
||||
settingsDialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
|
||||
// End of first event listener for DOM content loaded
|
||||
|
||||
// Format time
|
||||
function formatTime(time) {
|
||||
const minutes = Math.floor(time / 60) || 0;
|
||||
const seconds = Math.floor(time % 60) || 0;
|
||||
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
const showDialogBtn = document.getElementById('showDialogBtn');
|
||||
const hideDialogBtn = document.getElementById('hideDialogBtn');
|
||||
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
||||
|
||||
// Show dialog
|
||||
showDialogBtn.addEventListener('click', () => {
|
||||
dialogOverlay.style.display = 'block';
|
||||
});
|
||||
|
||||
// Hide dialog
|
||||
hideDialogBtn.addEventListener('click', () => {
|
||||
dialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
// Fullscreen functionality
|
||||
fullscreenBtn.addEventListener('click', () => {
|
||||
if (!document.fullscreenElement) {
|
||||
mediaPlayer.requestFullscreen();
|
||||
} else {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// End of code and second event listener for DOM content loaded
|
||||
|
||||
});
|
210
simpliplay-legacy/src/styles.css
Normal file
210
simpliplay-legacy/src/styles.css
Normal file
@ -0,0 +1,210 @@
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
src: url('fonts/Inter_18pt-Regular.ttf') format('truetype');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Inter-header';
|
||||
src: url('fonts/Inter_24pt-Bold.ttf');
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Inter-header", Arial, sans-serif !important;
|
||||
}
|
||||
|
||||
.w-gap {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: "Inter", Arial, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Inter", Arial, sans-serif;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
background: linear-gradient(135deg, #083358, #1a73e8);
|
||||
color: white;
|
||||
}
|
||||
|
||||
#saveSettingsBtn:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#saveSettingsBtn {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog-overlay,
|
||||
.subtitles-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.dialog,
|
||||
.subtitles-dialog {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #ffffff;
|
||||
color: #333;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
width: 90%;
|
||||
max-width: 400px;
|
||||
text-align: center;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.dialog input[type="url"],
|
||||
.subtitles-dialog input[type="url"] {
|
||||
width: 80%;
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #ccc;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.dialog button,
|
||||
.subtitles-dialog button {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog button:hover,
|
||||
.subtitles-dialog button:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#customControls {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#customControls button,
|
||||
input[type="range"] {
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#customControls button {
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#customControls button:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#showDialogBtn:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
input[type="range"] {
|
||||
flex-grow: 1;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#colorsLabel {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#colorsCheckbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
video {
|
||||
/* To make color pop: filter: contrast(1.1) saturate(1.2);*/
|
||||
display: flex;
|
||||
margin: 20px auto;
|
||||
background: black;
|
||||
width: 80vw;
|
||||
height: 80vh;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
|
||||
.gap-box {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.settings-info {
|
||||
font-size: 0.85em;
|
||||
color: #888;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#showDialogBtn {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#settingsBtn {
|
||||
background: #1a73e8;
|
||||
font-size: 18px;
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#settingsBtn:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#fileInput {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#settingsPanel {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #ffffff;
|
||||
color: black;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
z-index: 10000;
|
||||
text-align: center;
|
||||
}
|
Loading…
Reference in New Issue
Block a user