How to use subtitle - 10 common examples

To help you get started, we’ve selected a few subtitle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github France-ioi / codecast / frontend / subtitles / loading.js View on Github external
function* subtitlesReloadSaga (_action) {
  const scope = yield select(state => state.get('scope'));
  const {selectedKey: key, availableOptions} = yield select(state => state.get('subtitles'));
  if (key) {
    /* Generate an initial item covering the entire recording (needed because
       the editor works by splitting existing items at a specific position). */
    let text = (availableOptions[key].text || '').trim();
    if (!text) {
      const data = yield select(state => state.getIn(['player', 'data']));
      text = srtStringify([{start: 0, end: data.events[data.events.length - 1][0], text: ''}]);
    }
    yield put({type: scope.subtitlesLoadFromText, payload: {key, text}});
  }
}
github DefinitelyTyped / DefinitelyTyped / types / subtitle / subtitle-tests.ts View on Github external
import * as Subtitle from 'subtitle';

Subtitle.parse("");

const subtitles = [
        {
            start: '00:00:20,000',
            end: '00:00:24,400',
            text: 'Bla Bla Bla Bla'
        },
        {
            start: 24600,
            end: 27800,
            text: 'Bla Bla Bla Bla',
            settings: 'align:middle line:90%'
        }
    ];

const srt = Subtitle.stringify(subtitles);
github DefinitelyTyped / DefinitelyTyped / types / subtitle / subtitle-tests.ts View on Github external
start: '00:00:20,000',
            end: '00:00:24,400',
            text: 'Bla Bla Bla Bla'
        },
        {
            start: 24600,
            end: 27800,
            text: 'Bla Bla Bla Bla',
            settings: 'align:middle line:90%'
        }
    ];

const srt = Subtitle.stringify(subtitles);
const vtt = Subtitle.stringifyVtt(subtitles);

const newSubtitles: Subtitle.subTitleType[] = Subtitle.resync(subtitles, 1000);

Subtitle.toMS('00:00:24,400');

Subtitle.toSrtTime(24400);

Subtitle.toVttTime(24400);
github DefinitelyTyped / DefinitelyTyped / types / subtitle / subtitle-tests.ts View on Github external
const subtitles = [
        {
            start: '00:00:20,000',
            end: '00:00:24,400',
            text: 'Bla Bla Bla Bla'
        },
        {
            start: 24600,
            end: 27800,
            text: 'Bla Bla Bla Bla',
            settings: 'align:middle line:90%'
        }
    ];

const srt = Subtitle.stringify(subtitles);
const vtt = Subtitle.stringifyVtt(subtitles);

const newSubtitles: Subtitle.subTitleType[] = Subtitle.resync(subtitles, 1000);

Subtitle.toMS('00:00:24,400');

Subtitle.toSrtTime(24400);

Subtitle.toVttTime(24400);
github DefinitelyTyped / DefinitelyTyped / types / subtitle / subtitle-tests.ts View on Github external
const subtitles = [
        {
            start: '00:00:20,000',
            end: '00:00:24,400',
            text: 'Bla Bla Bla Bla'
        },
        {
            start: 24600,
            end: 27800,
            text: 'Bla Bla Bla Bla',
            settings: 'align:middle line:90%'
        }
    ];

const srt = Subtitle.stringify(subtitles);
const vtt = Subtitle.stringifyVtt(subtitles);

const newSubtitles: Subtitle.subTitleType[] = Subtitle.resync(subtitles, 1000);

Subtitle.toMS('00:00:24,400');

Subtitle.toSrtTime(24400);

Subtitle.toVttTime(24400);
github DefinitelyTyped / DefinitelyTyped / types / subtitle / subtitle-tests.ts View on Github external
text: 'Bla Bla Bla Bla'
        },
        {
            start: 24600,
            end: 27800,
            text: 'Bla Bla Bla Bla',
            settings: 'align:middle line:90%'
        }
    ];

const srt = Subtitle.stringify(subtitles);
const vtt = Subtitle.stringifyVtt(subtitles);

const newSubtitles: Subtitle.subTitleType[] = Subtitle.resync(subtitles, 1000);

Subtitle.toMS('00:00:24,400');

Subtitle.toSrtTime(24400);

Subtitle.toVttTime(24400);
github DefinitelyTyped / DefinitelyTyped / types / subtitle / subtitle-tests.ts View on Github external
{
            start: 24600,
            end: 27800,
            text: 'Bla Bla Bla Bla',
            settings: 'align:middle line:90%'
        }
    ];

const srt = Subtitle.stringify(subtitles);
const vtt = Subtitle.stringifyVtt(subtitles);

const newSubtitles: Subtitle.subTitleType[] = Subtitle.resync(subtitles, 1000);

Subtitle.toMS('00:00:24,400');

Subtitle.toSrtTime(24400);

Subtitle.toVttTime(24400);
github DefinitelyTyped / DefinitelyTyped / types / subtitle / subtitle-tests.ts View on Github external
end: 27800,
            text: 'Bla Bla Bla Bla',
            settings: 'align:middle line:90%'
        }
    ];

const srt = Subtitle.stringify(subtitles);
const vtt = Subtitle.stringifyVtt(subtitles);

const newSubtitles: Subtitle.subTitleType[] = Subtitle.resync(subtitles, 1000);

Subtitle.toMS('00:00:24,400');

Subtitle.toSrtTime(24400);

Subtitle.toVttTime(24400);
github matvp91 / indigo-player / src / extensions / SubtitlesExtension / SubtitlesExtension.ts View on Github external
private async parseSubtitleFile(url: string): Promise {
    const log = this.instance.log('SubtitlesExtension.parseSubtitleFile');

    if (!this.timingsCache[url]) {
      try {
        const content = await fetch(url).then(response => response.text());
        this.timingsCache[url] = SubtitleParser.parse(content);
        log(`Parsed ${url}`, { trackTimings: this.timingsCache[url] });
      } catch (error) {
        this.timingsCache[url] = [];
        log(`Failed to parse ${url}`);
      }
    }

    return this.timingsCache[url];
  }
}
github calaldees / KaraKara / player2 / src / demo.js View on Github external
function get_lyrics(srt) {
    let xhr = new XMLHttpRequest();
    let data = "";
    xhr.open('GET', "https://files.shishnet.org/karakara-demo/"+srt, false);
    xhr.onload = function(e) {
        data = e.target.responseText;
    };
    xhr.send();
    return Subtitle.parse(data);
}

subtitle

Stream-based library for parsing and manipulating subtitles

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis