Add files via upload

This commit is contained in:
Anirudh Sevugan 2025-02-06 11:19:06 +05:30 committed by GitHub
parent 2b6091748d
commit 70264f426e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 6206 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
# fonts
folder for custom fonts

View File

@ -0,0 +1,44 @@
const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');
module.exports = {
packagerConfig: {
asar: true,
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
plugins: [
{
name: '@electron-forge/plugin-auto-unpack-natives',
config: {},
},
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};

BIN
simpliplay/icon.icns Normal file

Binary file not shown.

BIN
simpliplay/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

BIN
simpliplay/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

88
simpliplay/index.html Normal file
View File

@ -0,0 +1,88 @@
<!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';
">
<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>
<input type="range" id="seekBar" min="0" value="0" step="0.1">
<span id="timeDisplay">00:00 / 00:00</span>
<button id="volumeBtn">🔊</button>
<input type="range" id="volumeBar" min="0" max="1" step="0.1" value="1">
<button id="fullscreenBtn"></button>
<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>
<button id="saveSettingsBtn">Save Settings</button>
</div>
</div>
<script src="./renderer.js"></script>
</body>
</html>

View File

@ -0,0 +1,14 @@
# dash.js BSD License Agreement
The copyright in this software is being made available under the BSD License, included below. This software may be subject to other third party and contributor rights, including patent rights, and no such rights are granted under this license.
**Copyright (c) 2015, Dash Industry Forum.
**All rights reserved.**
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Dash Industry Forum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
**THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.**

3
simpliplay/lib/dash.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,28 @@
Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
src/remux/mp4-generator.js and src/demux/exp-golomb.ts implementation in this project
are derived from the HLS library for video.js (https://github.com/videojs/videojs-contrib-hls)
That work is also covered by the Apache 2 License, following copyright:
Copyright (c) 2013-2015 Brightcove
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.

2
simpliplay/lib/hls.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,28 @@
Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
src/remux/mp4-generator.js and src/demux/exp-golomb.ts implementation in this project
are derived from the HLS library for video.js (https://github.com/videojs/videojs-contrib-hls)
That work is also covered by the Apache 2 License, following copyright:
Copyright (c) 2013-2015 Brightcove
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.

View 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.

View File

@ -0,0 +1,14 @@
# dash.js BSD License Agreement
The copyright in this software is being made available under the BSD License, included below. This software may be subject to other third party and contributor rights, including patent rights, and no such rights are granted under this license.
**Copyright (c) 2015, Dash Industry Forum.
**All rights reserved.**
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Dash Industry Forum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
**THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.**

112
simpliplay/main.js Normal file
View File

@ -0,0 +1,112 @@
const { app, BrowserWindow, Menu, MenuItem, shell, dialog } = require('electron');
const path = require('path');
const fs = require('fs');
const os = require('os');
let mainWindow;
let pipItem; // Define pipItem
let isPip = false; // Track PiP status
// Create the main window
const createWindow = () => {
mainWindow = new BrowserWindow({
width: 1920,
height: 1080,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true,
},
});
mainWindow.loadFile('index.html');
// Create context menu
const contextMenu = new Menu();
// Snapshot functionality
contextMenu.append(new MenuItem({
label: 'Take a snapshot',
click: () => {
mainWindow.webContents.capturePage().then(image => {
const png = image.toPNG();
const snapshotsDir = path.join(os.homedir(), 'simpliplay-snapshots');
fs.mkdirSync(snapshotsDir, { recursive: true });
const filePath = path.join(snapshotsDir, `snapshot-${Date.now()}.png`);
fs.writeFileSync(filePath, png);
shell.openPath(path.dirname(filePath));
}).catch(error => {
console.error("Error capturing snapshot:", error);
dialog.showErrorBox("Snapshot Error", "Failed to capture snapshot: " + error.message);
});
}
}));
contextMenu.append(new MenuItem({ type: 'separator' }));
contextMenu.append(new MenuItem({
label: 'Inspect',
click: () => {
mainWindow.webContents.openDevTools();
}
}));
// Set the context menu when right-click is detected
mainWindow.webContents.on('context-menu', (event, params) => {
event.preventDefault();
contextMenu.popup({ window: mainWindow });
});
// Modify the default menu (this includes File, Edit, etc.)
const menu = Menu.getApplicationMenu();
if (menu) {
// Find the Help menu and add custom items to it
const helpMenu = menu.items.find(item => item.label === 'Help');
if (helpMenu) {
// Add your custom items
helpMenu.submenu.append(new MenuItem({
label: 'Source code',
click: () => {
shell.openExternal('https://github.com/A-Star100/simpliplay-desktop'); // Replace with your actual documentation URL
}
}));
helpMenu.submenu.append(new MenuItem({
label: 'Website',
click: () => {
shell.openExternal('https://simpliplay.netlify.app'); // Replace with your actual documentation URL
}
}));
// Add a separator before the quit option (optional)
helpMenu.submenu.append(new MenuItem({ type: 'separator' }));
helpMenu.submenu.append(new MenuItem({
label: 'Quit',
click: () => {
app.quit();
}
}));
}
}
// Set the updated application menu
Menu.setApplicationMenu(menu);
};
// Handle window events and app lifecycle
app.whenReady().then(() => {
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});

5248
simpliplay/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

38
simpliplay/package.json Normal file
View File

@ -0,0 +1,38 @@
{
"name": "SimpliPlay",
"version": "1.0.1",
"description": "The mission to make media playback accessible on every device, anywhere, anytime.",
"main": "main.js",
"scripts": {
"test": "echo Hello World!!!",
"start": "electron-forge start",
"package": "electron-builder --dir",
"make": "electron-builder"
},
"author": "Anirudh Sevugan",
"build": {
"appId": "com.anirudhsevugan.simpliPlay",
"productName": "SimpliPlay",
"directories": {
"output": "dist"
},
"mac": {
"target": [
"dmg"
],
"icon": "icon.icns"
},
"win": {
"target": "msi",
"icon": "icon.ico"
},
"linux": {
"target": "AppImage",
"icon": "icon.png"
}
},
"devDependencies": {
"electron": "^34.0.1",
"electron-builder": "^25.1.8"
}
}

295
simpliplay/player.js Normal file
View File

@ -0,0 +1,295 @@
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 showDialogBtn = document.getElementById('showDialogBtn');
const hideDialogBtn = document.getElementById('hideDialogBtn');
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 fullscreenBtn = document.getElementById('fullscreenBtn');
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 subtitlesOverlay = document.getElementById('subtitlesOverlay');
const subtitlesInput = document.getElementById('subtitlesInput');
const submitSubtitlesBtn = document.getElementById('submitSubtitlesBtn');
const cancelSubtitlesBtn = document.getElementById('cancelSubtitlesBtn');
const customControls = document.getElementById('customControls');
// 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 (url.includes('.m3u8')) {
// HLS stream
if (Hls.isSupported()) {
mediaPlayer.style.display = 'flex'; // Hide the native video player
const hls = new Hls();
mediaPlayer.pause();
hls.loadSource(url);
hls.attachMedia(mediaPlayer);
hls.on(Hls.Events.MANIFEST_PARSED, function() {
mediaPlayer.play();
urlInput.value = "";
customControls.style.display = 'flex';
});
} else {
alert("HLS isn't supported on your browser.");
customControls.style.display = 'flex';
urlInput.value = "";
}
} else if (url.includes('.mpd')) {
mediaPlayer.style.display = 'flex'; // Hide the native video player
mediaPlayer.pause();
const player = dashjs.MediaPlayer().create();
// MPEG-DASH stream
player.initialize(mediaPlayer, url, true);
customControls.style.display = 'flex';
urlInput.value = "";
} else {
mediaPlayer.style.display = 'flex'; // Hide the native video player
mediaPlayer.pause();
mediaPlayer.src = url;
customControls.style.display = 'flex';
urlInput.value = "";
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();
});
// Handle file input
fileInput.addEventListener('change', (event) => {
const file = event.target.files[0];
if (file) {
clearSubtitles();
const fileURL = URL.createObjectURL(file);
mediaPlayer.src = fileURL;
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.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;
});
// Show settings panel
settingsBtn.addEventListener('click', () => {
settingsDialogOverlay.style.display = 'block';
settingsPanel.style.display = 'block';
});
// Save settings
saveSettingsBtn.addEventListener('click', () => {
autoplayEnabled = autoplayCheckbox.checked;
loopEnabled = loopCheckbox.checked;
mediaPlayer.autoplay = autoplayEnabled;
mediaPlayer.loop = loopEnabled;
settingsPanel.style.display = 'none';
settingsDialogOverlay.style.display = 'none';
});
});
// 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')}`;
}
document.addEventListener('DOMContentLoaded', () => {
// 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();
}
});
});

8
simpliplay/preload.js Normal file
View File

@ -0,0 +1,8 @@
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
togglePip: (isPip) => ipcRenderer.send('toggle-pip', isPip),
onPipItem: (callback) => ipcRenderer.on('pip-item', callback),
// Add other safe APIs here as needed
snapshot: () => ipcRenderer.send('snapshot'), // Example for snapshot
});

0
simpliplay/renderer.js Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

190
simpliplay/styles.css Normal file
View File

@ -0,0 +1,190 @@
@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;
}
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;
}
video, iframe {
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);
}
iframe {
border: none;
}
.gap-box {
height: 20px;
}
#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;
}