Lite version source

This commit is contained in:
Anirudh Sevugan 2025-02-02 10:12:23 +05:30 committed by GitHub
parent ecf035c73f
commit 6e83352609
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 3357 additions and 0 deletions

1099
simpliplay-lite/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
{
"dependencies": {
"@neutralinojs/neu": "^11.3.1"
}
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Neutralinojs and contributors
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.

View File

@ -0,0 +1,15 @@
# neutralinojs-minimal
The default template for a Neutralinojs app. It's possible to use your favorite frontend framework by using [these steps](https://neutralino.js.org/docs/getting-started/using-frontend-libraries).
## Contributors
[![Contributors](https://contrib.rocks/image?repo=neutralinojs/neutralinojs-minimal)](https://github.com/neutralinojs/neutralinojs-minimal/graphs/contributors)
## License
[MIT](LICENSE)
## Icon credits
- `trayIcon.png` - Made by [Freepik](https://www.freepik.com) and downloaded from [Flaticon](https://www.flaticon.com)

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

View File

@ -0,0 +1,83 @@
{
"$schema": "https://raw.githubusercontent.com/neutralinojs/neutralinojs/main/schemas/neutralino.config.schema.json",
"applicationId": "com.anirudhsevugan.simpliplay-lite",
"version": "1.0.0",
"defaultMode": "window",
"port": 0,
"documentRoot": "/resources/",
"url": "/",
"enableServer": true,
"enableNativeAPI": true,
"tokenSecurity": "one-time",
"logging": {
"enabled": true,
"writeToLogFile": true
},
"nativeAllowList": [
"app.*",
"os.*",
"debug.log"
],
"globalVariables": {
"TEST1": "Hello",
"TEST2": [
2,
4,
5
],
"TEST3": {
"value1": 10,
"value2": {}
}
},
"modes": {
"window": {
"title": "SimpliPlay Lite",
"width": 800,
"height": 500,
"minWidth": 400,
"minHeight": 200,
"center": true,
"fullScreen": false,
"alwaysOnTop": false,
"icon": "/resources/icons/icon.png",
"enableInspector": true,
"borderless": false,
"maximize": false,
"hidden": false,
"resizable": true,
"exitProcessOnClose": false
},
"browser": {
"globalVariables": {
"TEST": "Test value browser"
},
"nativeBlockList": [
"filesystem.*"
]
},
"cloud": {
"url": "/resources/#cloud",
"nativeAllowList": [
"app.*"
]
},
"chrome": {
"width": 800,
"height": 500,
"args": "--user-agent=\"Neutralinojs chrome mode\"",
"nativeBlockList": [
"filesystem.*",
"os.*"
]
}
},
"cli": {
"binaryName": "simpliplay",
"resourcesPath": "/resources/",
"extensionsPath": "/extensions/",
"clientLibrary": "/resources/js/neutralino.js",
"binaryVersion": "5.6.0",
"clientVersion": "5.6.0"
}
}

View File

@ -0,0 +1,26 @@
INFO 2025-02-02 04:28:35,259 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
INFO 2025-02-02 04:30:07,305 Reloading the application... api/debug/debug.cpp:17 sevuganfamily@unknown-host
INFO 2025-02-02 04:30:25,477 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
INFO 2025-02-02 04:31:23,167 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
INFO 2025-02-02 04:33:00,403 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
INFO 2025-02-02 04:33:20,146 Reloading the application... api/debug/debug.cpp:17 sevuganfamily@unknown-host
ERROR 2025-02-02 04:33:20,204 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/dash.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
ERROR 2025-02-02 04:33:20,207 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/hls.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
ERROR 2025-02-02 04:33:20,752 NE_RS_UNBLDRE: Unable to load application resource file /resources/fonts/inter.ttf api/debug/debug.cpp:20 sevuganfamily@unknown-host
INFO 2025-02-02 04:33:25,555 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
ERROR 2025-02-02 04:33:26,610 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/dash.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
ERROR 2025-02-02 04:33:26,611 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/hls.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
ERROR 2025-02-02 04:33:26,676 NE_RS_UNBLDRE: Unable to load application resource file /resources/fonts/inter.ttf api/debug/debug.cpp:20 sevuganfamily@unknown-host
INFO 2025-02-02 04:39:49,855 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
ERROR 2025-02-02 04:39:50,877 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/dash.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
ERROR 2025-02-02 04:39:50,878 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/hls.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
ERROR 2025-02-02 04:39:50,937 NE_RS_UNBLDRE: Unable to load application resource file /resources/fonts/inter.ttf api/debug/debug.cpp:20 sevuganfamily@unknown-host
INFO 2025-02-02 04:40:59,335 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
INFO 2025-02-02 04:42:21,305 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
ERROR 2025-02-02 04:47:03,173 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/dash.all.min.js.map api/debug/debug.cpp:20 sevuganfamily@unknown-host
ERROR 2025-02-02 04:47:03,174 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/hls.min.js.map api/debug/debug.cpp:20 sevuganfamily@unknown-host
INFO 2025-02-02 06:38:06,459 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
INFO 2025-02-02 06:45:56,054 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
INFO 2025-02-02 06:56:23,357 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
INFO 2025-02-02 07:04:32,553 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
INFO 2025-02-02 07:06:05,107 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

View File

@ -0,0 +1,508 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!--<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">-->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="lib/dash.js"></script>
<script src="lib/hls.js"></script>
<title>SimpliPlay Lite</title>
<style>
@font-face {
font-family: "Inter";
src: url("fonts/inter.ttf") format("truetype");
}
body {
font-family: "Inter", Arial, sans-serif;
text-align: center;
padding: 20px;
margin: 0;
background: linear-gradient(135deg, #0d5a9d, #0e7aff);
color: white;
}
#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;
}
#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;
}
</style>
</head>
<body>
<h1>SimpliPlay</h1>
<small>Lite Edition</small>
<div class="dialog-overlay" id="dialogOverlay">
<div class="dialog">
<p>Select how you want to load media:</p>
<button id="chooseFileBtn" style="display:none;">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/*" style="display: none;">
</div>
</div>
<div class="dialog-overlay" id="urlDialogOverlay">
<div class="dialog">
<p>Enter the media URL:</p>
<input type="url" id="urlInput" placeholder="Enter 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 subtitle URL:</p>
<input type="url" id="subtitlesInput" placeholder="Enter subtitle 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 CC</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>
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');
// Handle submit subtitle URL
submitSubtitlesBtn.addEventListener('click', () => {
const subtitleUrl = subtitlesInput.value;
if (subtitleUrl) {
const track = document.createElement('track');
track.kind = 'subtitles';
track.label = 'English';
track.srclang = 'en';
track.src = subtitleUrl;
mediaPlayer.appendChild(track);
subtitlesOverlay.style.display = 'none';
subtitlesInput.value = '';
}
});
// Function to add subtitles dynamically (e.g., after URL input)
function addSubtitles(url) {
subtitleTrack.src = url;
subtitleTrack.track.mode = 'showing'; // Enable subtitles by default
subtitleBtn.textContent = 'Subtitles On'; // Set button text to indicate subtitles are on
}
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) {
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 not 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) {
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';
}
});
// 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
// YouTube ID extractor
function getYouTubeID(url) {
const match = url.match(/[?&]v=([a-zA-Z0-9_-]+)/);
return match ? match[1] : null;
}
// Vimeo ID extractor
function getVimeoID(url) {
const match = url.match(/vimeo.com\/(\d+)/);
return match ? match[1] : null;
}
// 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')}`;
}
// 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();
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,99 @@
// This is just a sample app. You can structure your Neutralinojs app code as you wish.
// This example app is written with vanilla JavaScript and HTML.
// Feel free to use any frontend framework you like :)
// See more details: https://neutralino.js.org/docs/how-to/use-a-frontend-library
/*
Function to display information about the Neutralino app.
This function updates the content of the 'info' element in the HTML
with details regarding the running Neutralino application, including
its ID, port, operating system, and version information.
*/
function showInfo() {
document.getElementById('info').innerHTML = `
${NL_APPID} is running on port ${NL_PORT} inside ${NL_OS}
<br/><br/>
<span>server: v${NL_VERSION} . client: v${NL_CVERSION}</span>
`;
}
/*
Function to open the official Neutralino documentation in the default web browser.
*/
function openDocs() {
Neutralino.os.open("https://neutralino.js.org/docs");
}
/*
Function to open a tutorial video on Neutralino's official YouTube channel in the default web browser.
*/
function openTutorial() {
Neutralino.os.open("https://www.youtube.com/c/CodeZri");
}
/*
Function to set up a system tray menu with options specific to the window mode.
This function checks if the application is running in window mode, and if so,
it defines the tray menu items and sets up the tray accordingly.
*/
function setTray() {
// Tray menu is only available in window mode
if(NL_MODE != "window") {
console.log("INFO: Tray menu is only available in the window mode.");
return;
}
// Define tray menu items
let tray = {
icon: "/resources/icons/trayIcon.png",
menuItems: [
{id: "VERSION", text: "Get version"},
{id: "SEP", text: "-"},
{id: "QUIT", text: "Quit"}
]
};
// Set the tray menu
Neutralino.os.setTray(tray);
}
/*
Function to handle click events on the tray menu items.
This function performs different actions based on the clicked item's ID,
such as displaying version information or exiting the application.
*/
function onTrayMenuItemClicked(event) {
switch(event.detail.id) {
case "VERSION":
// Display version information
Neutralino.os.showMessageBox("Version information",
`Neutralinojs server: v${NL_VERSION} | Neutralinojs client: v${NL_CVERSION}`);
break;
case "QUIT":
// Exit the application
Neutralino.app.exit();
break;
}
}
/*
Function to handle the window close event by gracefully exiting the Neutralino application.
*/
function onWindowClose() {
Neutralino.app.exit();
}
// Initialize Neutralino
Neutralino.init();
// Register event listeners
Neutralino.events.on("trayMenuItemClicked", onTrayMenuItemClicked);
Neutralino.events.on("windowClose", onWindowClose);
// Conditional initialization: Set up system tray if not running on macOS
if(NL_OS != "Darwin") { // TODO: Fix https://github.com/neutralinojs/neutralinojs/issues/615
setTray();
}
// Display app information
showInfo();

View File

@ -0,0 +1,834 @@
// Type definitions for Neutralino 5.6.0
// Project: https://github.com/neutralinojs
// Definitions project: https://github.com/neutralinojs/neutralino.js
declare namespace Neutralino {
namespace filesystem {
interface DirectoryEntry {
entry: string;
path: string;
type: string;
}
interface FileReaderOptions {
pos: number;
size: number;
}
interface DirectoryReaderOptions {
recursive: boolean;
}
interface OpenedFile {
id: number;
eof: boolean;
pos: number;
lastRead: number;
}
interface Stats {
size: number;
isFile: boolean;
isDirectory: boolean;
createdAt: number;
modifiedAt: number;
}
interface Watcher {
id: number;
path: string;
}
interface CopyOptions {
recursive: boolean;
overwrite: boolean;
skip: boolean;
}
interface PathParts {
rootName: string;
rootDirectory: string;
rootPath: string;
relativePath: string;
parentPath: string;
filename: string;
stem: string;
extension: string;
}
function createDirectory(path: string): Promise<void>;
function remove(path: string): Promise<void>;
function writeFile(path: string, data: string): Promise<void>;
function appendFile(path: string, data: string): Promise<void>;
function writeBinaryFile(path: string, data: ArrayBuffer): Promise<void>;
function appendBinaryFile(path: string, data: ArrayBuffer): Promise<void>;
function readFile(path: string, options?: FileReaderOptions): Promise<string>;
function readBinaryFile(path: string, options?: FileReaderOptions): Promise<ArrayBuffer>;
function openFile(path: string): Promise<number>;
function createWatcher(path: string): Promise<number>;
function removeWatcher(id: number): Promise<number>;
function getWatchers(): Promise<Watcher[]>;
function updateOpenedFile(id: number, event: string, data?: any): Promise<void>;
function getOpenedFileInfo(id: number): Promise<OpenedFile>;
function readDirectory(path: string, options?: DirectoryReaderOptions): Promise<DirectoryEntry[]>;
function copy(source: string, destination: string, options?: CopyOptions): Promise<void>;
function move(source: string, destination: string): Promise<void>;
function getStats(path: string): Promise<Stats>;
function getAbsolutePath(path: string): Promise<string>;
function getRelativePath(path: string, base?: string): Promise<string>;
function getPathParts(path: string): Promise<PathParts>;
}
namespace os {
// debug
enum LoggerType {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO"
}
// os
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
//clipboard
enum ClipboardFormat {
unknown = "unknown",
text = "text",
image = "image"
}
// NL_GLOBALS
enum Mode {
window = "window",
browser = "browser",
cloud = "cloud",
chrome = "chrome"
}
enum OperatingSystem {
Linux = "Linux",
Windows = "Windows",
Darwin = "Darwin",
FreeBSD = "FreeBSD",
Unknown = "Unknown"
}
enum Architecture {
x64 = "x64",
arm = "arm",
itanium = "itanium",
ia32 = "ia32",
unknown = "unknown"
}
interface ExecCommandOptions {
stdIn?: string;
background?: boolean;
cwd?: string;
}
interface ExecCommandResult {
pid: number;
stdOut: string;
stdErr: string;
exitCode: number;
}
interface SpawnedProcess {
id: number;
pid: number;
}
interface Envs {
[key: string]: string;
}
interface OpenDialogOptions {
multiSelections?: boolean;
filters?: Filter[];
defaultPath?: string;
}
interface FolderDialogOptions {
defaultPath?: string;
}
interface SaveDialogOptions {
forceOverwrite?: boolean;
filters?: Filter[];
defaultPath?: string;
}
interface Filter {
name: string;
extensions: string[];
}
interface TrayOptions {
icon: string;
menuItems: TrayMenuItem[];
}
interface TrayMenuItem {
id?: string;
text: string;
isDisabled?: boolean;
isChecked?: boolean;
}
type KnownPath = "config" | "data" | "cache" | "documents" | "pictures" | "music" | "video" | "downloads" | "savedGames1" | "savedGames2" | "temp";
function execCommand(command: string, options?: ExecCommandOptions): Promise<ExecCommandResult>;
function spawnProcess(command: string, cwd?: string): Promise<SpawnedProcess>;
function updateSpawnedProcess(id: number, event: string, data?: any): Promise<void>;
function getSpawnedProcesses(): Promise<SpawnedProcess[]>;
function getEnv(key: string): Promise<string>;
function getEnvs(): Promise<Envs>;
function showOpenDialog(title?: string, options?: OpenDialogOptions): Promise<string[]>;
function showFolderDialog(title?: string, options?: FolderDialogOptions): Promise<string>;
function showSaveDialog(title?: string, options?: SaveDialogOptions): Promise<string>;
function showNotification(title: string, content: string, icon?: Icon): Promise<void>;
function showMessageBox(title: string, content: string, choice?: MessageBoxChoice, icon?: Icon): Promise<string>;
function setTray(options: TrayOptions): Promise<void>;
function open(url: string): Promise<void>;
function getPath(name: KnownPath): Promise<string>;
}
namespace computer {
interface MemoryInfo {
physical: {
total: number;
available: number;
};
virtual: {
total: number;
available: number;
};
}
interface KernelInfo {
variant: string;
version: string;
}
interface OSInfo {
name: string;
description: string;
version: string;
}
interface CPUInfo {
vendor: string;
model: string;
frequency: number;
architecture: string;
logicalThreads: number;
physicalCores: number;
physicalUnits: number;
}
interface Display {
id: number;
resolution: Resolution;
dpi: number;
bpp: number;
refreshRate: number;
}
interface Resolution {
width: number;
height: number;
}
interface MousePosition {
x: number;
y: number;
}
function getMemoryInfo(): Promise<MemoryInfo>;
function getArch(): Promise<string>;
function getKernelInfo(): Promise<KernelInfo>;
function getOSInfo(): Promise<OSInfo>;
function getCPUInfo(): Promise<CPUInfo>;
function getDisplays(): Promise<Display[]>;
function getMousePosition(): Promise<MousePosition>;
}
namespace storage {
function setData(key: string, data: string): Promise<void>;
function getData(key: string): Promise<string>;
function getKeys(): Promise<string[]>;
}
namespace debug {
// debug
enum LoggerType {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO"
}
// os
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
//clipboard
enum ClipboardFormat {
unknown = "unknown",
text = "text",
image = "image"
}
// NL_GLOBALS
enum Mode {
window = "window",
browser = "browser",
cloud = "cloud",
chrome = "chrome"
}
enum OperatingSystem {
Linux = "Linux",
Windows = "Windows",
Darwin = "Darwin",
FreeBSD = "FreeBSD",
Unknown = "Unknown"
}
enum Architecture {
x64 = "x64",
arm = "arm",
itanium = "itanium",
ia32 = "ia32",
unknown = "unknown"
}
function log(message: string, type?: LoggerType): Promise<void>;
}
namespace app {
interface OpenActionOptions {
url: string;
}
interface RestartOptions {
args: string;
}
function exit(code?: number): Promise<void>;
function killProcess(): Promise<void>;
function restartProcess(options?: RestartOptions): Promise<void>;
function getConfig(): Promise<any>;
function broadcast(event: string, data?: any): Promise<void>;
function readProcessInput(readAll?: boolean): Promise<string>;
function writeProcessOutput(data: string): Promise<void>;
function writeProcessError(data: string): Promise<void>;
}
namespace window {
interface WindowOptions extends WindowSizeOptions, WindowPosOptions {
title?: string;
icon?: string;
fullScreen?: boolean;
alwaysOnTop?: boolean;
enableInspector?: boolean;
borderless?: boolean;
maximize?: boolean;
hidden?: boolean;
maximizable?: boolean;
useSavedState?: boolean;
exitProcessOnClose?: boolean;
extendUserAgentWith?: string;
injectGlobals?: boolean;
injectClientLibrary?: boolean;
injectScript?: string;
processArgs?: string;
}
interface WindowSizeOptions {
width?: number;
height?: number;
minWidth?: number;
minHeight?: number;
maxWidth?: number;
maxHeight?: number;
resizable?: boolean;
}
interface WindowPosOptions {
x: number;
y: number;
}
function setTitle(title: string): Promise<void>;
function getTitle(): Promise<string>;
function maximize(): Promise<void>;
function unmaximize(): Promise<void>;
function isMaximized(): Promise<boolean>;
function minimize(): Promise<void>;
function unminimize(): Promise<void>;
function isMinimized(): Promise<boolean>;
function setFullScreen(): Promise<void>;
function exitFullScreen(): Promise<void>;
function isFullScreen(): Promise<boolean>;
function show(): Promise<void>;
function hide(): Promise<void>;
function isVisible(): Promise<boolean>;
function focus(): Promise<void>;
function setIcon(icon: string): Promise<void>;
function move(x: number, y: number): Promise<void>;
function center(): Promise<void>;
type DraggableRegionOptions = {
/**
* If set to `true`, the region will always capture the pointer,
* ensuring dragging doesn't break on fast pointer movement.
* Note that it prevents child elements from receiving any pointer events.
* Defaults to `false`.
*/
alwaysCapture?: boolean;
/**
* Minimum distance between cursor's starting and current position
* after which dragging is started. This helps prevent accidental dragging
* while interacting with child elements.
* Defaults to `10`. (In pixels.)
*/
dragMinDistance?: number;
};
function setDraggableRegion(domElementOrId: string | HTMLElement, options?: DraggableRegionOptions): Promise<{
success: true;
message: string;
}>;
function unsetDraggableRegion(domElementOrId: string | HTMLElement): Promise<{
success: true;
message: string;
}>;
function setSize(options: WindowSizeOptions): Promise<void>;
function getSize(): Promise<WindowSizeOptions>;
function getPosition(): Promise<WindowPosOptions>;
function setAlwaysOnTop(onTop: boolean): Promise<void>;
function create(url: string, options?: WindowOptions): Promise<void>;
function snapshot(path: string): Promise<void>;
}
namespace events {
interface Response {
success: boolean;
message: string;
}
type Builtin = "ready" | "trayMenuItemClicked" | "windowClose" | "serverOffline" | "clientConnect" | "clientDisconnect" | "appClientConnect" | "appClientDisconnect" | "extClientConnect" | "extClientDisconnect" | "extensionReady" | "neuDev_reloadApp";
function on(event: string, handler: (ev: CustomEvent) => void): Promise<Response>;
function off(event: string, handler: (ev: CustomEvent) => void): Promise<Response>;
function dispatch(event: string, data?: any): Promise<Response>;
function broadcast(event: string, data?: any): Promise<void>;
}
namespace extensions {
interface ExtensionStats {
loaded: string[];
connected: string[];
}
function dispatch(extensionId: string, event: string, data?: any): Promise<void>;
function broadcast(event: string, data?: any): Promise<void>;
function getStats(): Promise<ExtensionStats>;
}
namespace updater {
interface Manifest {
applicationId: string;
version: string;
resourcesURL: string;
}
function checkForUpdates(url: string): Promise<Manifest>;
function install(): Promise<void>;
}
namespace clipboard {
interface ClipboardImage {
width: number;
height: number;
bpp: number;
bpr: number;
redMask: number;
greenMask: number;
blueMask: number;
redShift: number;
greenShift: number;
blueShift: number;
data: ArrayBuffer;
}
// debug
enum LoggerType {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO"
}
// os
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
//clipboard
enum ClipboardFormat {
unknown = "unknown",
text = "text",
image = "image"
}
// NL_GLOBALS
enum Mode {
window = "window",
browser = "browser",
cloud = "cloud",
chrome = "chrome"
}
enum OperatingSystem {
Linux = "Linux",
Windows = "Windows",
Darwin = "Darwin",
FreeBSD = "FreeBSD",
Unknown = "Unknown"
}
enum Architecture {
x64 = "x64",
arm = "arm",
itanium = "itanium",
ia32 = "ia32",
unknown = "unknown"
}
function getFormat(): Promise<ClipboardFormat>;
function readText(): Promise<string>;
function readImage(format?: string): Promise<ClipboardImage | null>;
function writeText(data: string): Promise<void>;
function writeImage(image: ClipboardImage): Promise<void>;
function clear(): Promise<void>;
}
namespace resources {
interface Stats {
size: number;
isFile: boolean;
isDirectory: boolean;
}
function getFiles(): Promise<string[]>;
function getStats(path: string): Promise<Stats>;
function extractFile(path: string, destination: string): Promise<void>;
function extractDirectory(path: string, destination: string): Promise<void>;
function readFile(path: string): Promise<string>;
function readBinaryFile(path: string): Promise<ArrayBuffer>;
}
namespace server {
function mount(path: string, target: string): Promise<void>;
function unmount(path: string): Promise<void>;
function getMounts(): Promise<void>;
}
namespace custom {
function getMethods(): Promise<string[]>;
}
interface InitOptions {
exportCustomMethods?: boolean;
}
function init(options?: InitOptions): void;
type ErrorCode = "NE_FS_DIRCRER" | "NE_FS_RMDIRER" | "NE_FS_FILRDER" | "NE_FS_FILWRER" | "NE_FS_FILRMER" | "NE_FS_NOPATHE" | "NE_FS_COPYFER" | "NE_FS_MOVEFER" | "NE_OS_INVMSGA" | "NE_OS_INVKNPT" | "NE_ST_INVSTKY" | "NE_ST_STKEYWE" | "NE_RT_INVTOKN" | "NE_RT_NATPRME" | "NE_RT_APIPRME" | "NE_RT_NATRTER" | "NE_RT_NATNTIM" | "NE_CL_NSEROFF" | "NE_EX_EXTNOTC" | "NE_UP_CUPDMER" | "NE_UP_CUPDERR" | "NE_UP_UPDNOUF" | "NE_UP_UPDINER";
interface Error {
code: ErrorCode;
message: string;
}
interface OpenActionOptions {
url: string;
}
interface RestartOptions {
args: string;
}
interface MemoryInfo {
physical: {
total: number;
available: number;
};
virtual: {
total: number;
available: number;
};
}
interface KernelInfo {
variant: string;
version: string;
}
interface OSInfo {
name: string;
description: string;
version: string;
}
interface CPUInfo {
vendor: string;
model: string;
frequency: number;
architecture: string;
logicalThreads: number;
physicalCores: number;
physicalUnits: number;
}
interface Display {
id: number;
resolution: Resolution;
dpi: number;
bpp: number;
refreshRate: number;
}
interface Resolution {
width: number;
height: number;
}
interface MousePosition {
x: number;
y: number;
}
interface ClipboardImage {
width: number;
height: number;
bpp: number;
bpr: number;
redMask: number;
greenMask: number;
blueMask: number;
redShift: number;
greenShift: number;
blueShift: number;
data: ArrayBuffer;
}
interface ExtensionStats {
loaded: string[];
connected: string[];
}
interface DirectoryEntry {
entry: string;
path: string;
type: string;
}
interface FileReaderOptions {
pos: number;
size: number;
}
interface DirectoryReaderOptions {
recursive: boolean;
}
interface OpenedFile {
id: number;
eof: boolean;
pos: number;
lastRead: number;
}
interface Stats {
size: number;
isFile: boolean;
isDirectory: boolean;
createdAt: number;
modifiedAt: number;
}
interface Watcher {
id: number;
path: string;
}
interface CopyOptions {
recursive: boolean;
overwrite: boolean;
skip: boolean;
}
interface PathParts {
rootName: string;
rootDirectory: string;
rootPath: string;
relativePath: string;
parentPath: string;
filename: string;
stem: string;
extension: string;
}
interface ExecCommandOptions {
stdIn?: string;
background?: boolean;
cwd?: string;
}
interface ExecCommandResult {
pid: number;
stdOut: string;
stdErr: string;
exitCode: number;
}
interface SpawnedProcess {
id: number;
pid: number;
}
interface Envs {
[key: string]: string;
}
interface OpenDialogOptions {
multiSelections?: boolean;
filters?: Filter[];
defaultPath?: string;
}
interface FolderDialogOptions {
defaultPath?: string;
}
interface SaveDialogOptions {
forceOverwrite?: boolean;
filters?: Filter[];
defaultPath?: string;
}
interface Filter {
name: string;
extensions: string[];
}
interface TrayOptions {
icon: string;
menuItems: TrayMenuItem[];
}
interface TrayMenuItem {
id?: string;
text: string;
isDisabled?: boolean;
isChecked?: boolean;
}
type KnownPath = "config" | "data" | "cache" | "documents" | "pictures" | "music" | "video" | "downloads" | "savedGames1" | "savedGames2" | "temp";
interface Manifest {
applicationId: string;
version: string;
resourcesURL: string;
}
interface WindowOptions extends WindowSizeOptions, WindowPosOptions {
title?: string;
icon?: string;
fullScreen?: boolean;
alwaysOnTop?: boolean;
enableInspector?: boolean;
borderless?: boolean;
maximize?: boolean;
hidden?: boolean;
maximizable?: boolean;
useSavedState?: boolean;
exitProcessOnClose?: boolean;
extendUserAgentWith?: string;
injectGlobals?: boolean;
injectClientLibrary?: boolean;
injectScript?: string;
processArgs?: string;
}
interface WindowSizeOptions {
width?: number;
height?: number;
minWidth?: number;
minHeight?: number;
maxWidth?: number;
maxHeight?: number;
resizable?: boolean;
}
interface WindowPosOptions {
x: number;
y: number;
}
interface Response {
success: boolean;
message: string;
}
type Builtin = "ready" | "trayMenuItemClicked" | "windowClose" | "serverOffline" | "clientConnect" | "clientDisconnect" | "appClientConnect" | "appClientDisconnect" | "extClientConnect" | "extClientDisconnect" | "extensionReady" | "neuDev_reloadApp";
}
// debug
enum LoggerType {
WARNING = 'WARNING',
ERROR = 'ERROR',
INFO = 'INFO'
}
// os
enum Icon {
WARNING = 'WARNING',
ERROR = 'ERROR',
INFO = 'INFO',
QUESTION = 'QUESTION'
}
enum MessageBoxChoice {
OK = 'OK',
OK_CANCEL = 'OK_CANCEL',
YES_NO = 'YES_NO',
YES_NO_CANCEL = 'YES_NO_CANCEL',
RETRY_CANCEL = 'RETRY_CANCEL',
ABORT_RETRY_IGNORE = 'ABORT_RETRY_IGNORE'
}
//clipboard
enum ClipboardFormat {
unknown = 'unknown',
text = 'text',
image = 'image'
}
// NL_GLOBALS
enum Mode {
window = 'window',
browser = 'browser',
cloud = 'cloud',
chrome = 'chrome'
}
enum OperatingSystem {
Linux = 'Linux',
Windows = 'Windows',
Darwin = 'Darwin',
FreeBSD = 'FreeBSD',
Unknown = 'Unknown'
}
enum Architecture {
x64 = 'x64',
arm = 'arm',
itanium = 'itanium',
ia32 = 'ia32',
unknown = 'unknown'
}
interface Response {
success: boolean;
message: string;
}
type Builtin =
'ready' |
'trayMenuItemClicked' |
'windowClose' |
'serverOffline' |
'clientConnect' |
'clientDisconnect' |
'appClientConnect' |
'appClientDisconnect' |
'extClientConnect' |
'extClientDisconnect' |
'extensionReady' |
'neuDev_reloadApp'
// --- globals ---
/** Mode of the application: window, browser, cloud, or chrome */
declare const NL_MODE: Mode;
/** Application port */
declare const NL_PORT: number;
/** Command-line arguments */
declare const NL_ARGS: string[];
/** Basic authentication token */
declare const NL_TOKEN: string;
/** Neutralinojs client version */
declare const NL_CVERSION: string;
/** Application identifier */
declare const NL_APPID: string;
/** Application version */
declare const NL_APPVERSION: string;
/** Application path */
declare const NL_PATH: string;
/** Application data path */
declare const NL_DATAPATH: string;
/** Returns true if extensions are enabled */
declare const NL_EXTENABLED: boolean;
/** Returns true if the client library is injected */
declare const NL_GINJECTED: boolean;
/** Returns true if globals are injected */
declare const NL_CINJECTED: boolean;
/** Operating system name: Linux, Windows, Darwin, FreeBSD, or Uknown */
declare const NL_OS: OperatingSystem;
/** CPU architecture: x64, arm, itanium, ia32, or unknown */
declare const NL_ARCH: Architecture;
/** Neutralinojs server version */
declare const NL_VERSION: string;
/** Current working directory */
declare const NL_CWD: string;
/** Identifier of the current process */
declare const NL_PID: string;
/** Source of application resources: bundle or directory */
declare const NL_RESMODE: string;
/** Release commit of the client library */
declare const NL_CCOMMIT: string;
/** An array of custom methods */
declare const NL_CMETHODS: string[];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,507 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!--<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">-->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="lib/dash.js"></script>
<script src="lib/hls.js"></script>
<title>SimpliPlay</title>
<style>
@font-face {
font-family: "Inter";
src: url("fonts/inter.ttf") format("truetype");
}
body {
font-family: "Inter", Arial, sans-serif;
text-align: center;
padding: 20px;
margin: 0;
background: linear-gradient(135deg, #083358, #1a73e8);
color: white;
}
#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;
}
#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;
}
</style>
</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/*" style="display: none;">
</div>
</div>
<div class="dialog-overlay" id="urlDialogOverlay">
<div class="dialog">
<p>Enter the media URL:</p>
<input type="url" id="urlInput" placeholder="Enter 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 subtitle URL:</p>
<input type="url" id="subtitlesInput" placeholder="Enter subtitle 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 CC</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>
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');
// Handle submit subtitle URL
submitSubtitlesBtn.addEventListener('click', () => {
const subtitleUrl = subtitlesInput.value;
if (subtitleUrl) {
const track = document.createElement('track');
track.kind = 'subtitles';
track.label = 'English';
track.srclang = 'en';
track.src = subtitleUrl;
mediaPlayer.appendChild(track);
subtitlesOverlay.style.display = 'none';
subtitlesInput.value = '';
}
});
// Function to add subtitles dynamically (e.g., after URL input)
function addSubtitles(url) {
subtitleTrack.src = url;
subtitleTrack.track.mode = 'showing'; // Enable subtitles by default
subtitleBtn.textContent = 'Subtitles On'; // Set button text to indicate subtitles are on
}
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) {
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 not 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) {
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';
}
});
// 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
// YouTube ID extractor
function getYouTubeID(url) {
const match = url.match(/[?&]v=([a-zA-Z0-9_-]+)/);
return match ? match[1] : null;
}
// Vimeo ID extractor
function getVimeoID(url) {
const match = url.match(/vimeo.com\/(\d+)/);
return match ? match[1] : null;
}
// 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')}`;
}
// 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();
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,20 @@
body {
background-color: white;
}
#neutralinoapp {
text-align: center;
-webkit-user-select: none;
user-select: none;
cursor: default;
}
#neutralinoapp h1{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 20px;
}
#neutralinoapp > div {
font-size: 16px;
font-weight: normal;
}