Skip to content

Commit e161556

Browse files
committed
write readme file about 11th project
1 parent 24b67f4 commit e161556

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

11-Custom-Video-Player/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# 11 - Custom Video Player
2+
3+
## About this
4+
- As name suggests a custom video player
5+
- Added fullscreen feature with keypress like if pressed `F` then maximize or minimize like in YouTube
6+
- Made keypress event of `space` like if spacebar pressed then video will be paused or played.
7+
- **Its CSS sucks like WTF to made this simple functionality**
8+
9+
## Things I learned
10+
- How to made hierachy of divs like in this we made a div of `player` in which there are two div `video` & `player__controls` & in that inside we have different controls.
11+
- Learn about **BEM** convention of writing CSS.
12+
- Learn more about range input field that step available in that.
13+
- `cursor: pointer` to change the cursor. Not knew about this before.
14+
- `background: transparent` to make background transparent.
15+
- *A good way to start with writing JavaScript*
16+
- get elements
17+
- build out functions
18+
- hook up event listener
19+
- Learn more about video functions in JavaScript like `video.paused`, `video.currentTime`, `video.duration`, `video.volume`, `video.playbackRate`.
20+
- `parseFloat()` to convert string to float.
21+
- `player.requestFullscreen` & `player.exitFullscreen` to maximize or minimize respectively.
22+
- **This project taught me very much. The End**
23+
24+
## Some important things
25+
- When we update progress bar then we keep check when mousedown then mousemove then mouseup.
26+
- We update progress bar when there is `timeupdate` event means currentTime changes otherwise it will be called in every millisecond thats will crash it.
27+
- When we want to take `keypress` event then we `addEventListener` on `window` not on player or anything bcoz we want global of DOM

11-Custom-Video-Player/script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ progress.addEventListener('mousemove', () => mousedown = false);
7373

7474
fullScreen.addEventListener('click', handleFullScreen);
7575

76-
window.addEventListener('keydown', (e) => {
76+
window.addEventListener('keypress', (e) => {
7777
if(e.key === 'f') handleFullScreen();
7878
if(e.key === ' ') togglePlay();
7979
})

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
| 8 | 🌈 Fun with HTML5 Canvas | [GitHub][8] | [Link](https://sagarmittal1.github.io/JavaScript30/08-HTML5-Canvas/)|
1616
| 9 | 🛠 Dev Tools Domination | - | [Link](https://sagarmittal1.github.io/JavaScript30/09-Dev-Tools)|
1717
| 10 | ✔ Multiple Check Shift | [GitHub][10] | [Link](https://sagarmittal1.github.io/JavaScript30/10-Multiple-Check-Shift/)|
18+
| 11 | 📽 Custom Video Player | [GitHub][11] | [Link](https://sagarmittal1.github.io/JavaScript30/11-Custom-Video-Player/)|
19+
1820

1921

2022
[1]: /01-JavaScript-Drum-Kit/
@@ -24,4 +26,5 @@
2426
[5]: /05-Flex-Panel-Gallery/
2527
[8]: /08-HTML5-Canvas/
2628
[9]: /09-Dev-Tools/
27-
[10]: /10-Multipe-Check-Shift/
29+
[10]: /10-Multipe-Check-Shift/
30+
[11]: /11-Custom-Video-Player/

0 commit comments

Comments
 (0)