Skip to content

Commit 47d143a

Browse files
authored
Merge branch 'master' into refactor/player-effect
2 parents 26d6de5 + db477ea commit 47d143a

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import YoutubeIframe from './src/YoutubeIframe';
22
import {getYoutubeMeta} from './src/oEmbed';
3+
import {
4+
PLAYER_STATES_NAMES as PLAYER_STATES,
5+
PLAYER_ERROR_NAMES as PLAYER_ERRORS,
6+
} from './src/constants';
37

48
export default YoutubeIframe;
5-
export {getYoutubeMeta};
9+
export {getYoutubeMeta, PLAYER_STATES, PLAYER_ERRORS};

src/constants.js

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,40 @@
1+
12
export const PLAY_MODE = true;
23
export const PAUSE_MODE = false;
34
export const MUTE_MODE = true;
45
export const UNMUTE_MODE = false;
56

7+
export const PLAYER_STATES_NAMES = {
8+
UNSTARTED: 'unstarted',
9+
ENDED: 'ended',
10+
PLAYING: 'playing',
11+
PAUSED: 'paused',
12+
BUFFERING: 'buffering',
13+
VIDEO_CUED: 'video cued',
14+
};
15+
616
export const PLAYER_STATES = {
7-
'-1': 'unstarted',
8-
'0': 'ended',
9-
'1': 'playing',
10-
'2': 'paused',
11-
'3': 'buffering',
12-
'5': 'video cued',
17+
'-1': PLAYER_STATES_NAMES.UNSTARTED,
18+
'0': PLAYER_STATES_NAMES.ENDED,
19+
'1': PLAYER_STATES_NAMES.PLAYING,
20+
'2': PLAYER_STATES_NAMES.PAUSED,
21+
'3': PLAYER_STATES_NAMES.BUFFERING,
22+
'5': PLAYER_STATES_NAMES.VIDEO_CUED,
23+
};
24+
25+
export const PLAYER_ERROR_NAMES = {
26+
INVALID_PARAMETER: 'invalid_parameter',
27+
HTML5_ERROR: 'HTML5_error',
28+
VIDEO_NOT_FOUND: 'video_not_found',
29+
EMBED_NOT_ALLOWED: 'embed_not_allowed',
1330
};
1431

1532
export const PLAYER_ERROR = {
16-
'2': 'invalid_parameter',
17-
'5': 'HTML5_error',
18-
'100': 'video_not_found',
19-
'101': 'embed_not_allowed',
20-
'150': 'embed_not_allowed',
33+
'2': PLAYER_ERROR_NAMES.INVALID_PARAMETER,
34+
'5': PLAYER_ERROR_NAMES.HTML5_ERROR,
35+
'100': PLAYER_ERROR_NAMES.VIDEO_NOT_FOUND,
36+
'101': PLAYER_ERROR_NAMES.EMBED_NOT_ALLOWED,
37+
'150': PLAYER_ERROR_NAMES.EMBED_NOT_ALLOWED,
2138
};
2239

2340
export const CUSTOM_USER_AGENT =

0 commit comments

Comments
 (0)