- From: Cheng Zheng via GitHub <sysbot+gh@w3.org>
- Date: Fri, 17 Jul 2020 08:42:50 +0000
- To: public-web-and-tv@w3.org
## One more possible way do to it. (for Desktop) If building a desktop app with electron.js [node-mpv](https://www.npmjs.com/package/node-mpv/v/2.0.0-beta.0) can be used to control a local version `mpv` so load subtitle and display subtitle is doable (.ass is fine) and edit it and then reload subtitle is also possible. frame to frame playback with left arrow key and right arrow key is also possible. ## Node.js code ```javascript const mpvAPI = require('node-mpv'); const mpv = new mpvAPI({}, [ "--autofit=50%", // initial windows size ]); mpv.start() .then(() => { // video return mpv.load('/Users/remote_edit/Documents/1111.mp4') }) .then(() => { // subtitle return mpv.addSubtitles('/Users/remote_edit/Documents/1111.ass') }) .then(() => { return mpv }) // this catches every arror from above .catch((error) => { console.log(error); }); // This will bind this function to the stopped event mpv.on('stopped', () => { console.log("Your favorite song just finished, let's start it again!"); // mpv.loadFile('/path/to/your/favorite/song.mp3'); }); ``` ## package.json ``` { "name": "test-mpv-node", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "node-mpv": "^2.0.0-beta.0" } } ``` -- GitHub Notification of comment by 1c7 Please view or discuss this issue at https://github.com/w3c/media-and-entertainment/issues/4#issuecomment-659966108 using your GitHub account
Received on Friday, 17 July 2020 08:42:52 UTC