<commit_before>// @flow
import 'babel-polyfill';
import * as React from 'react';
// @if TARGET='app'
import { remote } from 'electron';
import fs from 'fs';
// @endif
import path from 'path';
import player from 'render-media';
import FileRender from 'component/fileRender';
import LoadingScreen from 'component/common/loading-screen';

type Props = {
  contentType: string,
  mediaType: string,
  downloadCompleted: boolean,
  volume: number,
  position: ?number,
  downloadPath: string,
  fileName: string,
  claim: StreamClaim,
  onStartCb: ?() => void,
  onFinishCb: ?() => void,
  savePosition: number => void,
  changeVolume: number => void,
};

type State = {
  hasMetadata: boolean,
  unplayable: boolean,
  fileSource: ?{
    url?: string,
    fileName?: string,
    contentType?: string,
    downloadPath?: string,
    fileType?: string,
  },
};

class MediaPlayer extends React.PureComponent<Props, State> {
  static SANDBOX_TYPES = ['application/x-lbry', 'application/x-ext-lbry'];
  static FILE_MEDIA_TYPES = ['text', 'script', 'e-book', 'comic-book', 'document', '3D-file', 'video', 'audio'];
  static SANDBOX_SET_BASE_URL = 'http://localhost:5278/set/';
  static SANDBOX_CONTENT_BASE_URL = 'http://localhost:5278';

  mediaContainer: { current: React.ElementRef<any> };

  constructor(props: Props) {
    super(props);

    this.state = {<commit_msg>fix: use old player for audio/video in electron<commit_after>// @flow
import 'babel-polyfill';
import * as React from 'react';
// @if TARGET='app'
import { remote } from 'electron';
import fs from 'fs';
// @endif
import path from 'path';
import player from 'render-media';
import FileRender from 'component/fileRender';
import LoadingScreen from 'component/common/loading-screen';

type Props = {
  contentType: string,
  mediaType: string,
  downloadCompleted: boolean,
  volume: number,
  position: ?number,
  downloadPath: string,
  fileName: string,
  claim: StreamClaim,
  onStartCb: ?() => void,
  onFinishCb: ?() => void,
  savePosition: number => void,
  changeVolume: number => void,
};

type State = {
  hasMetadata: boolean,
  unplayable: boolean,
  fileSource: ?{
    url?: string,
    fileName?: string,
    contentType?: string,
    downloadPath?: string,
    fileType?: string,
  },
};

class MediaPlayer extends React.PureComponent<Props, State> {
  static SANDBOX_TYPES = ['application/x-lbry', 'application/x-ext-lbry'];
  static FILE_MEDIA_TYPES = [
    'text',
    'script',
    'e-book',
    'comic-book',
    'document',
    '3D-file',
    // @if TARGET='web'
    'video',
    'audio',
    // @endif
  ];
  static SANDBOX_SET_BASE_URL = 'http://localhost:5278/set/';
  static SANDBOX_CONTENT_BASE_URL = 'http://localhost:5278';

  mediaContainer: { current: React.ElementRef<any> };

  constructor(props: Props) {
    super(props);

    this.state = {
{'fraction_non_alphanumeric': 0.14804370814240395, 'fraction_numerical': 0.00634473034896017, 'mean_word_length': 4.086021505376344, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1362661', 'n_tokens_mistral': 964, 'n_tokens_neox': 937, 'n_words': 236}