Skip to content

Commit 61affa7

Browse files
author
Pietro Passarelli - News Labs
committed
Merge branch 'master' of github.com:bbc/react-transcript-editor
2 parents c323441 + ede8013 commit 61affa7

File tree

5 files changed

+45
-12
lines changed

5 files changed

+45
-12
lines changed

docs/qa/1-player-controls.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ From left to right
1818
| 1.1.8 |current time | display | display current time of media, updates while playing |
1919
| 1.1.9 |current time | click | triggers prompt to jump to set time, using custom formats options |
2020
| 1.1.10|Duration | display | display duration of media |
21-
| 1.1.11|'Picture in Picture' 📺 | click | hide or show video as separate window always on top |
22-
| 1.1.12|Volume | click - Toggle| Mutes and un-mutes media |
21+
| 1.1.11|Save | click on 💾 | should save content to local storage |
22+
| 1.1.12|'Picture in Picture' 📺 | click | hide or show video as separate window always on top |
23+
| 1.1.13|Volume | click - Toggle| Mutes and un-mutes media |
2324

2425
#### Item to test #1.2: Player Controls - Preview
2526

2627
![player-controls-preview](./images/player-controls-preview.png)
2728

2829
##### Steps:
29-
- Click on the media preview on the left
30+
- [ ] Click on the media preview on the left
3031
##### Expected Results:
3132
- [ ] if media paused expect to start playing
3233
- [ ] if media playing expect to pause playing
@@ -50,10 +51,19 @@ From left to right
5051

5152

5253
##### Steps:
53-
- Click the 'Picture in Picture' icon 📺
54+
- [ ] Click the 'Picture in Picture' icon 📺
5455

5556
##### Expected Results:
5657
- [ ] If video, expect the video to appear as resizable floating window always on top
5758
- [ ] Expect if click picture in picture icon again for video to go back to it's original place
5859
- [ ] if in chrome expect it to work
59-
- [ ] if in browser other then chrome (Safari, Firefox etc) expect to get warning message saying browser is not supported and to use in chrome instead.
60+
- [ ] if in browser other then chrome (Safari, Firefox etc) expect to get warning message saying browser is not supported and to use in chrome instead.
61+
62+
#### Item to test #1.11: Player Controls - Save 💾
63+
64+
##### Steps:
65+
- [ ] edit some text
66+
- [ ] Click the 'Save' icon 📺
67+
- [ ] refresh browser
68+
##### Expected Results:
69+
- [ ] Expect the text to persist after refresh

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@bbc/react-transcript-editor",
33
"description": "A React component to make transcribing audio and video easier and faster.",
4-
"version": "0.2.9",
4+
"version": "0.2.11",
55
"keywords": [
66
"transcript",
77
"transcriptions",

src/lib/TranscriptEditor/MediaPlayer/PlayerControls.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ import Select from './Select';
55

66
import style from './PlayerControls.module.css';
77

8+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9+
10+
import {
11+
faSave,
12+
faTv,
13+
faPlay,
14+
faPause,
15+
faBackward,
16+
faForward,
17+
faUndo
18+
} from '@fortawesome/free-solid-svg-icons';
19+
820
class PlayerControls extends React.Component {
921
// to handle backward and forward mouse pressed on btn
1022
// set a 300 ms interval to repeat the
@@ -34,28 +46,28 @@ class PlayerControls extends React.Component {
3446
<button
3547
className={ style.playerButton }
3648
onClick={ this.props.rollback }>
37-
{'↺'}
49+
<FontAwesomeIcon icon={ faUndo } />
3850
</button>
3951

4052
<button
4153
className={ style.playerButton }
4254
onMouseDown={ this.setIntervalHelperBackward }
4355
onMouseUp={ this.clearIntervalHelper }>
44-
{'◀◀'}
56+
<FontAwesomeIcon icon={ faBackward } />
4557

4658
</button>
4759

4860
<button
4961
className={ style.playerButton }
5062
onClick={ this.props.playMedia }>
51-
{this.props.isPlaying ? '❚❚' : '▶'}
63+
{this.props.isPlaying ? <FontAwesomeIcon icon={ faPause } /> : <FontAwesomeIcon icon={ faPlay } />}
5264
</button>
5365

5466
<button
5567
className={ style.playerButton }
5668
onMouseDown={ this.setIntervalHelperForward }
5769
onMouseUp={ this.clearIntervalHelper }>
58-
{'▶▶'}
70+
<FontAwesomeIcon icon={ faForward } />
5971
</button>
6072

6173
<span className={ style.playBackRate }>
@@ -74,11 +86,17 @@ class PlayerControls extends React.Component {
7486
<span className={ style.duration }>{this.props.duration}</span>
7587
</div>
7688

89+
<button
90+
className={ style.playerButton }
91+
onClick={ this.props.handleSaveTranscript }>
92+
<FontAwesomeIcon icon={ faSave } />
93+
</button>
94+
7795
<button
7896
className={ style.playerButton }
7997
onClick={ this.props.pictureInPicture }
8098
>
81-
{'📺'}
99+
<FontAwesomeIcon icon={ faTv } />
82100
</button>
83101

84102
<VolumeControl

src/lib/TranscriptEditor/MediaPlayer/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import returnHotKeys from './defaultHotKeys';
1010
import styles from './index.module.css';
1111

1212
import { secondsToTimecode, timecodeToSeconds } from '../../Util/timecode-converter/index';
13+
import { timingSafeEqual } from 'crypto';
1314

1415
const PLAYBACK_RATES = [
1516
{ value: 0.2, label: '0.2' },
@@ -436,6 +437,7 @@ class MediaPlayer extends React.Component {
436437
setPlayBackRate={ this.handlePlayBackRateChange.bind(this) }
437438
playbackRateOptions={ this.state.playbackRateOptions }
438439
pictureInPicture={ this.handlePictureInPicture }
440+
handleSaveTranscript={ () => {this.props.handleSaveTranscript();} }
439441
/>
440442
</div>
441443
);

src/lib/TranscriptEditor/TimedTextEditor/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ class TimedTextEditor extends React.Component {
6262
}
6363

6464
componentDidUpdate(prevProps, prevState) {
65-
if (prevState.transcriptData !== this.state.transcriptData) {
65+
if (
66+
(prevState.transcriptData !== this.state.transcriptData)
67+
&& ( this.props.mediaUrl!== null && !this.isPresentInLocalStorage(this.props.mediaUrl) )
68+
) {
6669
this.loadData();
6770
}
6871
if (prevState.timecodeOffset !== this.state.timecodeOffset

0 commit comments

Comments
 (0)