Closed Manishearth closed 2 years ago
Yes, is possible, here is a quick & dirty solution.
Make sure the video file can be play in Chrome
Open a blank page about:blank
, then "drag & drop" the video file in it, to check if Chrome shows a embed player and plays the file.
If Chrome popup a save-as file dialog, rename to video file extension name to .webm
(eg: test.mkv
to test.webm
) and try again.
Create a script type plugin in Dualsub
Here is the code for you to paste:
document.body.addEventListener('dragover', function(event) {
event.preventDefault();
});
document.body.addEventListener('drop', function(event) {
event.preventDefault();
const file = event.dataTransfer.items[0].getAsFile();
const video = document.querySelector('video[src]');
video.src = URL.createObjectURL(file);
});
Replace the video file
Open a random YouTube video page, then "drag & drop" the locale file in it, then the YouTube player will the local file.
You don't need to change the extension name to .webm
, because the JavaScript will force it to play inline.
The progress bar time is still adapt for the original video, so you need to find a longer YouTube video for your local file. eg: if your local file is 50 minutes long, you need a 50+ minutes YouTube video for the replacement.
The final solution is create a standalone website for this use case, see #315 I posted before, you can check it out with Google Translate if you're interested.
Sweet, thank you!
Now you can try player.dualsub.xyz
with Dualsub v1.79.0.
Open https://player.dualsub.xyz/?if=p
then drag a video file and some subtitle files to the page.
Thanks!
It's possible to simply open local video files in the browser, and they play as usual using a regular
<video>
tag.Since the extension has support for uploading custom subtitle files, it would be nice if it would be possible to use local video files as well by opening them in the browser and then adding the custom subtitle files.