Skip to content

Commit

Permalink
replace fromCharCode with utf8ArrayToStr
Browse files Browse the repository at this point in the history
  • Loading branch information
DanFerrer committed Nov 2, 2017
1 parent 7cc7490 commit 786eb1c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/utils/webvtt-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ const WebVTTParser = {
parse: function(vttByteArray, syncPTS, vttCCs, cc, callBack, errorCallBack) {
// Convert byteArray into string, replacing any somewhat exotic linefeeds with "\n", then split on that character.
let re = /\r\n|\n\r|\n|\r/g;
let vttLines = new Uint8Array(vttByteArray)
.reduce((raw, vttByte) => raw + String.fromCharCode(vttByte), '')
.trim().replace(re, '\n').split('\n');
let vttLines = utf8ArrayToStr(new Uint8Array(vttByteArray)).trim().replace(re, '\n').split('\n');

let cueTime = '00:00.000';
let mpegTs = 0;
Expand Down

0 comments on commit 786eb1c

Please sign in to comment.