videojs-ass
Version:
ASS/SSA subtitle overlay for videojs
68 lines (61 loc) • 2.28 kB
HTML
<html>
<head>
<title>Videojs ASS/SSA subtitles</title>
<!-- npm -->
<link href="node_modules/video.js/dist/video-js.min.css" rel="stylesheet">
<link href="node_modules/libjass/libjass.css" rel="stylesheet">
<script src="node_modules/video.js/dist/video.min.js"></script>
<script src="node_modules/libjass/libjass.js"></script>
<!-- bower-->
<!--
<link href="bower_components/videojs/dist/video-js.min.css" rel="stylesheet">
<link href="bower_components/libjass/libjass.css" rel="stylesheet">
<script src="bower_components/videojs/dist/video.min.js"></script>
<script src="bower_components/libjass/libjass.js"></script>
-->
<!-- src -->
<link href="src/videojs.ass.css" rel="stylesheet">
<script src="src/videojs.ass.js"></script>
</head>
<body>
<video id="player" class="video-js vjs-default-skin vjs-big-play-centered">
<!-- <source src="video/persona_alice.webm" type="video/webm"> -->
<source src="video/the_world_end_umbrella.webm" type="video/webm">
<!-- <source src="video/geometry.mp4" type="video/mp4"> -->
</video>
<script>
videojs('player', {
controls: true,
nativeControlsForTouch: false,
width: 640,
height: 360,
// fluid: true,
// plugins: {
// ass: {
// 'src': ["subs/os.ass"],
// videoWidth: 640,
// videoHeight: 360,
// // enableSvg: false
// }
// },
playbackRates: [0.5, 1, 1.5, 2]
});
var vjs = videojs('player');
// initialize the plugin this way to access internal methods
var vjs_ass = vjs.ass({
// src: ["subs/PersonaAlice.ass"],
src: ["subs/WorldUmbrellaSubs.ass"],
// 'src': ["subs/GeometricLoveSubs.ass"],
label: "engsub",
videoWidth: 540,
videoHeight: 360,
// enableSvg: false
});
// you will then be able to use the following js to switch subtitle
// vjs_ass.loadNewSubtitle('URL HERE')
// setTimeout(_ => vjs_ass.loadNewSubtitle('subs/os.ass'), 3000);
vjs_ass.loadNewSubtitle('subs/os.ass');
</script>
</body>
</html>