Comments (2)
Its simple, just put ASS content in a string literal:
window.SubtitlesOctopusOnLoad = function () {
var options = {
video: video,
subContent: `
[Script Info]
Title:
ScriptType: v4.00+
WrapStyle: 0
PlayResX: 640
PlayResY: 480
ScaledBorderAndShadow: yes
[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,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,0
Style: Alt,Times New Roman,40,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,8,10,10,10,0
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0000,0000,0000,,This is a test of the ASS format and some basic features in it.
`,
fonts: ['/JavascriptSubtitlesOctopus/fonts/Arial.ttf', '/JavascriptSubtitlesOctopus/fonts/TimesNewRoman.ttf'],
//onReady: onReadyFunction,
debug: true,
workerUrl: '/JavascriptSubtitlesOctopus/assets/js/subtitles-octopus-worker.js'
};
window.octopusInstance = new SubtitlesOctopus(options);
};
if (SubtitlesOctopus) {
SubtitlesOctopusOnLoad();
}
});
Try the example above, if it does not work, send me an example of what you're trying to do.
Off
@ErickVal Obrigado
from javascriptsubtitlesoctopus.
Thanks @TFSThiagoBR98 , I got it.
You can also get that via AJAX instead use .setTrackByUrl
var xhr=new XMLHttpRequest();
xhr.open("GET","http://xxxxxxx/subtitle.ass");
xhr.onload=function(){
window.octopusInstance.setTrack(xhr.responseText)
}
xhr.send();
from javascriptsubtitlesoctopus.
Related Issues (20)
- Brotli: "Uncaught Corrupted reserve bit" HOT 6
- I wish you will make a online demo HOT 1
- Feature request: Support effect in subtitles ass file HOT 1
- Drop custom brotli decompression HOT 7
- JSO never performs VSFilter colour mangling HOT 14
- JSO doesnโt nor enables users to set storage size HOT 1
- Failure to build HarfBuzz 5.3.1 with emscripten >=3.1.25 (libharfbuzz_la-hb-ft.lo) HOT 1
- HTML5 Native player Multi Track
- Resize makes subtitle disappear HOT 1
- SubtitlesOctopus Nextjs Runtime Error HOT 4
- how to use directly with CDN? HOT 6
- Failed to construct 'Worker': Script at 'https://libass.github.io/JavascriptSubtitlesOctopus/assets/js/subtitles-octopus-worker.js' cannot be accessed from origin ''. HOT 11
- How to get the bounding box of the subtitle? HOT 2
- Unable to Set Caching Policy for Remote Fonts
- There is a problem with subtitles jumping when using Arabic HOT 2
- need custom wasm url config
- The onReady function was triggered before the font had finished loading.
- If the subtitle is empty or all spaces, the rendering fails
- Inconsistency in Font Size Between Chinese and English Characters in Mixed Subtitles
- Custom Fonts are not working. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javascriptsubtitlesoctopus.