Skip to content

Commit d031b11

Browse files
committed
fix control change icon
1 parent bc63545 commit d031b11

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

11 Custom Video Player/scripts.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
//click view play and pause
22
function switchPlayAndPause() {
3-
const ctrl = document.querySelector('.player__button[title="Toggle Play"]');
4-
53
if(video_application.paused) {
64
video_application.play();
7-
ctrl.textContent = '>';
85
}
96
else {
107
video_application.pause();
11-
ctrl.textContent = '||';
128
}
139
}
1410
const video_application = document.querySelector('.player__video');
@@ -20,11 +16,12 @@ play_or_pause_ctrl.addEventListener('click', switchPlayAndPause);
2016

2117
//video event update icon
2218
function updateIcon() {
19+
const ctrl = document.querySelector('.player__button[title="Toggle Play"]');
2320
if(video_application.paused) {
24-
this.textContent = '>';
21+
ctrl.textContent = '>';
2522
}
2623
else {
27-
this.textContent = '||';
24+
ctrl.textContent = '||';
2825
}
2926
}
3027
video_application.addEventListener('play', updateIcon);

0 commit comments

Comments
 (0)