mirror of
https://github.com/A-Star100/simpliplay-desktop.git
synced 2025-09-17 22:29:38 +00:00
Compare commits
10 Commits
ae127fb837
...
257218c5a1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
257218c5a1 | ||
![]() |
808c275167 | ||
![]() |
5d49c97662 | ||
![]() |
16311d2eff | ||
![]() |
4a23d31b03 | ||
![]() |
97088fb943 | ||
![]() |
b987f539f8 | ||
![]() |
117d2950ea | ||
![]() |
0aa0e06194 | ||
![]() |
2ddce17442 |
@ -6,7 +6,7 @@ const { pathToFileURL } = require("url");
|
||||
const { checkForUpdate } = require('./updateChecker');
|
||||
let gpuAccel = "";
|
||||
let didRegisterShortcuts = false;
|
||||
let version = "2.1.2.0"
|
||||
let version = "2.1.3.0"
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
if (process.argv.includes('--use-gl')) {
|
||||
|
@ -6,7 +6,7 @@ const { pathToFileURL } = require("url");
|
||||
const { checkForUpdate } = require('./updateChecker');
|
||||
let gpuAccel = "";
|
||||
let didRegisterShortcuts = false;
|
||||
let version = "2.1.2.0"
|
||||
let version = "2.1.3.0"
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
if (process.argv.includes('--use-gl')) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "SimpliPlay",
|
||||
"version": "2.1.2",
|
||||
"version": "2.1.3",
|
||||
"description": "SimpliPlay - The mission to make media playback accessible on every device, anywhere, anytime.",
|
||||
"main": "./main.js",
|
||||
"scripts": {
|
||||
@ -113,7 +113,7 @@
|
||||
"allowToChangeInstallationDirectory": true
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^38.0.0",
|
||||
"electron": "^38.1.0",
|
||||
"electron-builder": "^26.0.12"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "SimpliPlay",
|
||||
"version": "2.1.2",
|
||||
"version": "2.1.3",
|
||||
"description": "The mission to make media playback accessible on every platform, anywhere, anytime.",
|
||||
"main": "./main.js",
|
||||
"scripts": {
|
||||
@ -118,7 +118,7 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^38.0.0",
|
||||
"electron": "^38.1.0",
|
||||
"electron-builder": "^26.0.12"
|
||||
}
|
||||
}
|
||||
|
@ -272,6 +272,7 @@ const { isHLS, isDASH } = await detectStreamType(url);
|
||||
|
||||
|
||||
let previousObjectURL = null; // Store the last Object URL
|
||||
window.objectURL = previousObjectURL
|
||||
|
||||
fileInput.addEventListener('change', (event) => {
|
||||
if (hls !== null) {
|
||||
@ -292,7 +293,13 @@ const { isHLS, isDASH } = await detectStreamType(url);
|
||||
// Revoke the previous Object URL if it exists
|
||||
if (previousObjectURL) {
|
||||
URL.revokeObjectURL(previousObjectURL);
|
||||
window.objectURL = previousObjectURL
|
||||
}
|
||||
|
||||
// Revoke previous file picker Object URL
|
||||
if (window.previousDropURL) {
|
||||
URL.revokeObjectURL(window.previousDropURL);
|
||||
}
|
||||
|
||||
// Create a new Object URL for the selected file
|
||||
const fileURL = URL.createObjectURL(file);
|
||||
|
@ -16,6 +16,109 @@ function loadMedia(fileURL) {
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const dropArea = document.createElement('div');
|
||||
dropArea.style.position = 'fixed';
|
||||
dropArea.style.top = '0';
|
||||
dropArea.style.left = '0';
|
||||
dropArea.style.width = '100vw';
|
||||
dropArea.style.height = '100vh';
|
||||
dropArea.style.display = 'none'; // hidden by default
|
||||
dropArea.style.zIndex = '0'; // behind everything
|
||||
dropArea.style.opacity = '0'; // invisible
|
||||
document.body.appendChild(dropArea);
|
||||
|
||||
let dragCounter = 0; // track nested dragenter/dragleave events
|
||||
|
||||
|
||||
window.addEventListener('dragenter', (e) => {
|
||||
if (e.dataTransfer.types.includes('Files')) {
|
||||
dragCounter++;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('dragleave', (e) => {
|
||||
if (e.dataTransfer.types.includes('Files')) {
|
||||
dragCounter--;
|
||||
if (dragCounter <= 0) dragCounter = 0;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('dragover', (e) => {
|
||||
if (e.dataTransfer.types.includes('Files')) {
|
||||
e.preventDefault(); // allow drop
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
let previousDropURL = null; // Store last Object URL
|
||||
window.previousDropURL = previousDropURL
|
||||
|
||||
window.addEventListener('drop', e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const file = e.dataTransfer.files[0];
|
||||
if (!file) return;
|
||||
|
||||
// Destroy existing HLS/DASH instances if they exist
|
||||
if (window.hls) {
|
||||
window.hls.destroy();
|
||||
window.hls = null;
|
||||
}
|
||||
if (window.dash) {
|
||||
window.dash.reset();
|
||||
window.dash = null;
|
||||
}
|
||||
|
||||
// Clear previously loaded subtitles
|
||||
const tracks = mediaElement.getElementsByTagName('track');
|
||||
for (let i = tracks.length - 1; i >= 0; i--) {
|
||||
tracks[i].remove();
|
||||
}
|
||||
|
||||
// Revoke previous Object URL
|
||||
if (previousDropURL) {
|
||||
URL.revokeObjectURL(previousDropURL);
|
||||
window.previousDropURL = previousDropURL;
|
||||
}
|
||||
|
||||
// Revoke previous file picker Object URL
|
||||
if (window.objectURL) {
|
||||
URL.revokeObjectURL(window.objectURL);
|
||||
}
|
||||
|
||||
// Create a new Object URL
|
||||
const fileURL = URL.createObjectURL(file);
|
||||
mediaElement.src = fileURL;
|
||||
|
||||
|
||||
// Only attempt to play if the browser thinks it can handle this type
|
||||
if (mediaElement.canPlayType(file.type)) {
|
||||
mediaElement.load();
|
||||
// Autoplay if checkbox is checked
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaElement.play().catch(err => console.warn(err));
|
||||
}
|
||||
} else {
|
||||
console.warn("SimpliPlay does not support this video type:", file.type);
|
||||
}
|
||||
|
||||
// Store for future cleanup
|
||||
previousDropURL = fileURL;
|
||||
|
||||
// Hide file dialog if applicable
|
||||
if (dialogOverlay) dialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
// Handle submit subtitle URL
|
||||
function clearSubtitles() {
|
||||
const tracks = mediaElement.getElementsByTagName('track');
|
||||
@ -97,3 +200,5 @@ window.electron.receive("unload-addon", (fileURL) => {
|
||||
unloadAddon(fileURL);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user