pietrop / digital-paper-edit-client

Work in progress -digital paper edit project - React Client
https://pietropassarelli.com/digital-paper-edit-client/
Other
13 stars 5 forks source link

audio file should have transcript editor audio layout #13

Closed pietrop closed 4 years ago

pietrop commented 4 years ago

There doesn't seem to be a super reliable way to determine if a file is a video or audio file but it be good to switch the transcript editor UI so that if it's audio it has the audio layout (eg without the video preview)

Screen Shot 2020-02-12 at 12 14 25 AM

eg mp4 is hard to know if it's audio or video, but mp3, wav etc.. could be set transcript editor attribute to audio as a first pass..

pietrop commented 4 years ago

fixed by checking source clipName extension

  // Workaround to change layout of TranscriptEditor for audio files. 
    // For now only handling limited numnber of file extension that have more of a certainty of being audio
    // as opposed to more ambiguos extensions such as ogg or mp4 that could be either video or audio
    // there might be better ways to determine if a clip is audio or video, especially node/"server side" but
    // might also be more of a setup eg using ffprobe etc..
    let mediaType = 'video';
    if(path.extname(this.state.clipName) ==='.wav' 
      || path.extname(this.state.clipName) ==='.mp3' 
      || path.extname(this.state.clipName) ==='.m4a' 
      || path.extname(this.state.clipName) ==='.flac' 
      || path.extname(this.state.clipName) ==='.aiff'){
      mediaType = 'audio'
    }

fixed in this commit https://github.com/pietrop/digital-paper-edit-client/commit/1c3aec047ec7bb6bbcc0dba9fa2fa1c2e595fbf5

tested by changing in server repo the sample transcript data

-"clipName": "KateDarling_2018S-950k.mp4",
+"clipName": "KateDarling_2018S-950k.wav",
Screen Shot 2020-02-19 at 9 41 53 PM