/
actions.js
100 lines (81 loc) · 2.13 KB
/
actions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import alt from '../../alt'
import _ from 'lodash';
import ipc from 'ipc';
import subUtil from './utils/subtitles';
class PlayerActions {
constructor() {
this.generateActions(
'play',
'playItem',
'pause',
'prev',
'next',
'stop',
'stopped',
'volume',
'mute',
'playing',
'uiShown',
'position',
'buffering',
'seekable',
'time',
'length',
'scrobble',
'scrobbleState',
'opening',
'error',
'ended',
'mediaChanged',
'fullscreen',
'settingChange',
'metaUpdate',
'wcjsInit',
'close',
'addPlaylist',
'togglePlaylist',
'toggleSubtitles',
'toggleSettings',
'setPlaylist',
'replaceMRL',
'setSubtitle',
'setSubDelay',
'setAudioDelay',
'delayTime',
'scrobbleKeys',
'itemCount',
'itemDesc',
'setDesc',
'setRate',
'pulse',
'flood',
'announcement',
'updateImage'
);
}
loadSub(subLink) {
subUtil.loadSubtitle(subLink, parsedSub => {
this.actions.setSubtitle(parsedSub);
this.actions.setSubDelay(0);
});
}
createPlaylist(files) {
}
toggleAlwaysOnTop(state = true) {
ipc.send('app:alwaysOnTop', state);
}
togglePowerSave(state = true) {
ipc.send('app:powerSaveBlocker', state);
}
toggleFullscreen(state) {
this.dispatch();
window.document.querySelector(".render-holder > div:first-of-type").style.display = 'none';
_.delay(() => {
window.document.querySelector(".render-holder > div:first-of-type").style.display = 'block';
}, 1000);
ipc.send('app:fullscreen', state);
this.actions.fullscreen(state);
}
}
export
default alt.createActions(PlayerActions);