miru/app/test.html
2021-03-25 11:57:50 +01:00

49 lines
No EOL
1.7 KiB
HTML

<video src="https://openings.moe/video/Kobayashi-SanChiNoMaidDragon-OP01-NCBD.mp4" muted controls id="video"></video>
<script src="js/subtitles-octopus.js"></script>
<script>
video.addEventListener('timeupdate',(e)=>console.log(e.target.currentTime))
let ready = function () {
console.log("ready")
octopusInstance.createEvent({
Duration: 2960,
Effect: "",
Layer: 100,
MarginL: 0,
MarginR: 0,
MarginV: 0,
Name: "",
ReadOrder: 0,
Start: 180,
Style: 1,
Text: "Miss Kobayashi's Dragon Something!",
})
octopusInstance.createEvent({
Duration: 1750,
Effect: "",
Layer: 100,
MarginL: 0,
MarginR: 0,
MarginV: 0,
Name: "",
ReadOrder: 1,
Start: 1940,
Style: 1,
Text: "What's with the "
})
}
let header = `[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Roboto Medium,26,&H00FFFFFF,&H000000FF,&H00020713,&H00000000,0,0,0,0,100,100,0,0,1,1.3,0,2,20,20,23,1`
let options = {
video: video,
fonts: ["https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fBBc4.woff2"],
workerUrl: 'js/subtitles-octopus-worker.js',
subContent: header,
renderMode: "offscreenCanvas",
debug: true,
onError: console.log
};
let octopusInstance = new SubtitlesOctopus(options);
setTimeout(ready, 1000)
</script>