File tree Expand file tree Collapse file tree 3 files changed +11
-17
lines changed Expand file tree Collapse file tree 3 files changed +11
-17
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // From https://github.com/darkskyapp/string-hash
2+ export function hash ( text : string ) {
3+ let hash = 5381 ;
4+ let i = text . length ;
5+ while ( i ) {
6+ hash = ( hash * 33 ) ^ text . charCodeAt ( -- i ) ;
7+ }
8+
9+ return ( hash >>> 0 ) . toString ( ) ;
10+ }
Original file line number Diff line number Diff line change 11import { VTTParser } from './vttparser' ;
22import { utf8ArrayToStr } from '@svta/common-media-library/utils/utf8ArrayToStr' ;
3+ import { hash } from './hash' ;
34import {
45 RationalTimestamp ,
56 toMpegTsClockFromTimescale ,
@@ -45,17 +46,6 @@ const cueString2millis = function (timeString: string) {
4546 return ts ;
4647} ;
4748
48- // From https://github.com/darkskyapp/string-hash
49- const hash = function ( text : string ) {
50- let hash = 5381 ;
51- let i = text . length ;
52- while ( i ) {
53- hash = ( hash * 33 ) ^ text . charCodeAt ( -- i ) ;
54- }
55-
56- return ( hash >>> 0 ) . toString ( ) ;
57- } ;
58-
5949// Create a unique hash id for a cue based on start/end times and text.
6050// This helps timeline-controller to avoid showing repeated captions.
6151export function generateCueId (
You can’t perform that action at this time.
0 commit comments