How to use the subtitle/lib/stringify function in subtitle

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 France-ioi / codecast / frontend / subtitles / editor.js View on Github external
return state.update('subtitles', function (subtitles) {
    const {selectedKey: key, availableOptions, items} = subtitles;
    const text = srtStringify(items)
    return clearNotify(update(subtitles, {availableOptions: {[key]: {text: {$set: text}}}}));
  });
}