forked from jomurgel/PocketCasterApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
media.js
30 lines (27 loc) · 1.02 KB
/
media.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
// Get the ipcRenderer of electron
const {ipcRenderer} = require('electron');
// Execute media key commands
ipcRenderer.on('media_play_pause', function(){
var btn = document.getElementsByClassName('play_pause_button')
if(btn.length > 0){
document.getElementsByClassName('play_pause_button')[0].click();
} else {
document.getElementsByClassName('animated-play-button')[0].click();
}
});
ipcRenderer.on('media_next',function(event,data){
var btn = document.getElementsByClassName('skip_forward_button')
if(btn.length > 0){
document.getElementsByClassName('skip_forward_button')[0].click();
} else {
document.getElementsByClassName('skip-forward-button')[0].click();
}
});
ipcRenderer.on('media_prev',function(event,data){
var btn = document.getElementsByClassName('skip_back_button')
if(btn.length > 0){
document.getElementsByClassName('skip_back_button')[0].click();
} else {
document.getElementsByClassName('skip-back-button')[0].click();
}
});