deestan / srt2vtt Goto Github PK
View Code? Open in Web Editor NEWEncoding-aware .srt (SubRip Text) to .vtt (WebVTT) converter.
Encoding-aware .srt (SubRip Text) to .vtt (WebVTT) converter.
NOTE
Converted from .srt via srt2vtt: https://github.com/deestan/srt2vtt
Causes video.textTracks[0].cues
to be empty on IE11; probably IE10 too.
Note that VTT files need also be served as Content-Type: text/vtt
for subtitles to work on IE11.
Many srt files are not cp1252 or utf8 encoded. I think it would be pretty helpful to enable reading those using their native encodings
When passing a UTF-8 encoded Buffer without a BOM it falls into the last conditional check // No BOM means CP1252 - convert
but it seems to be working anyway.
Should I worry about it?
Im getting this error when trying to execute your example script.
`C:\Users\user\Desktop\subs\node_modules\srt2vtt\node_modules\codepage\cputils.js:109
mdb.length = 2 * len;
^
TypeError: Cannot set property length of [object Object] which has only a getter
at sbcs_d (C:\Users\user\Desktop\subs\node_modules\srt2vtt\node_modules\codepage\cputils.js:109:20)
at Object.decode (C:\Users\user\Desktop\subs\node_modules\srt2vtt\node_modules\codepage\cputils.js:397:40)
at Object.convertToUTF8 (C:\Users\user\Desktop\subs\node_modules\srt2vtt\encoding.js:93:46)
at srt2vtt (C:\Users\user\Desktop\subs\node_modules\srt2vtt\index.js:45:12)
at Object. (C:\Users\user\Desktop\subs\test.js:5:1)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)`
eg: use Arraybuffer instead of buffer. That makes it more browser friendlier since it works in both environments
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.