This repository was archived by the owner on Sep 11, 2024. It is now read-only.
  
  
  - 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 815
 
Bring back waveform for voice messages and retain seeking #8843
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            11 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      48c06f8
              
                Crude way of layering the waveform and seek bar
              
              
                turt2live 470c1b8
              
                Use a layout prop instead of something less descriptive
              
              
                turt2live e7fe1b9
              
                Fix alignment properly, and play with styles
              
              
                turt2live eb118f5
              
                Convert back to a ball
              
              
                turt2live 86536ed
              
                Use `transparent` which makes NVDA happy enough
              
              
                turt2live 9dc36ba
              
                Allow keyboards in the seek bar
              
              
                turt2live 99b5f5c
              
                Try to make the clock behave more correctly with screen readers
              
              
                turt2live af4b323
              
                Remove legacy export
              
              
                turt2live a059059
              
                Remove redundant attr
              
              
                turt2live f829af0
              
                Merge branch 'develop' into travis/voice-messages-overlap
              
              
                turt2live 827c324
              
                Appease the linter
              
              
                turt2live File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -22,45 +22,68 @@ import AudioPlayerBase, { IProps as IAudioPlayerBaseProps } from "./AudioPlayerB | |
| import SeekBar from "./SeekBar"; | ||
| import PlaybackWaveform from "./PlaybackWaveform"; | ||
| 
     | 
||
| interface IProps extends IAudioPlayerBaseProps { | ||
| export enum PlaybackLayout { | ||
| /** | ||
| * Clock on the left side of a waveform, without seek bar. | ||
| */ | ||
| Composer, | ||
| 
     | 
||
| /** | ||
| * When true, use a waveform instead of a seek bar | ||
| * Clock on the right side of a waveform, with an added seek bar. | ||
| */ | ||
| withWaveform?: boolean; | ||
| Timeline, | ||
| } | ||
| 
     | 
||
| interface IProps extends IAudioPlayerBaseProps { | ||
| layout?: PlaybackLayout; // Defaults to Timeline layout | ||
| } | ||
| 
     | 
||
| export default class RecordingPlayback extends AudioPlayerBase<IProps> { | ||
| // This component is rendered in two ways: the composer and timeline. They have different | ||
| // rendering properties (specifically the difference of a waveform or not). | ||
| 
     | 
||
| private renderWaveformLook(): ReactNode { | ||
| private renderComposerLook(): ReactNode { | ||
| return <> | ||
| <PlaybackClock playback={this.props.playback} /> | ||
| <PlaybackWaveform playback={this.props.playback} /> | ||
| </>; | ||
| } | ||
| 
     | 
||
| private renderSeekableLook(): ReactNode { | ||
| private renderTimelineLook(): ReactNode { | ||
| return <> | ||
| <SeekBar | ||
| playback={this.props.playback} | ||
| tabIndex={-1} // prevent tabbing into the bar | ||
| playbackPhase={this.state.playbackPhase} | ||
| ref={this.seekRef} | ||
| /> | ||
| <div className="mx_RecordingPlayback_timelineLayoutMiddle"> | ||
| <PlaybackWaveform playback={this.props.playback} /> | ||
| <SeekBar | ||
| playback={this.props.playback} | ||
| tabIndex={0} // allow keyboard users to fall into the seek bar | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the default value ftr, both for inputs and for SeekBar's defaultProps  | 
||
| playbackPhase={this.state.playbackPhase} | ||
| ref={this.seekRef} | ||
| /> | ||
| </div> | ||
| <PlaybackClock playback={this.props.playback} /> | ||
| </>; | ||
| } | ||
| 
     | 
||
| protected renderComponent(): ReactNode { | ||
| let body: ReactNode; | ||
| switch (this.props.layout) { | ||
| case PlaybackLayout.Composer: | ||
| body = this.renderComposerLook(); | ||
| break; | ||
| case PlaybackLayout.Timeline: // default is timeline, fall through. | ||
| default: | ||
| body = this.renderTimelineLook(); | ||
| break; | ||
| } | ||
| 
     | 
||
| return ( | ||
| <div className="mx_MediaBody mx_VoiceMessagePrimaryContainer" onKeyDown={this.onKeyDown}> | ||
| <PlayPauseButton | ||
| playback={this.props.playback} | ||
| playbackPhase={this.state.playbackPhase} | ||
| ref={this.playPauseRef} | ||
| /> | ||
| { this.props.withWaveform ? this.renderWaveformLook() : this.renderSeekableLook() } | ||
| { body } | ||
| </div> | ||
| ); | ||
| } | ||
| 
          
            
          
           | 
    ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.