Skip to content

Commit 39a2a00

Browse files
committed
add update icon function
1 parent 97146f1 commit 39a2a00

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

11 Custom Video Player/scripts.js

+13
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ function switchPlayAndPause() {
1111
}
1212
}
1313

14+
function updateIcon() {
15+
if(video_application.paused) {
16+
this.textContent = '>';
17+
}
18+
else {
19+
this.textContent = '||';
20+
}
21+
}
22+
1423

1524
//click view play and pause
1625
const video_application = document.querySelector('.player__video');
@@ -20,6 +29,10 @@ video_application.addEventListener('click', switchPlayAndPause);
2029
const play_or_pause_ctrl = document.querySelector('.player__button[title="Toggle Play"]');
2130
play_or_pause_ctrl.addEventListener('click', switchPlayAndPause);
2231

32+
//video event update icon
33+
video_application.addEventListener('play', updateIcon);
34+
video_application.addEventListener('pause', updateIcon);
35+
2336
//process
2437
video_application.getProcess = function () {
2538
//value to view to

0 commit comments

Comments
 (0)