A clone of the YouTube video player in HTML, CSS and vanilla JavaScript with all the cool features such as volume controls, full screen, theater mode, captions, picture in picture, etc. but better...because this one doesn't have ads!!
βπ«π ππ
You can play any video that you want! Just access the application url: https://pncsoares.github.io/youtube-video-player-clone/src
I added one so you can test the web application but if you want to test it with one video of yours, just follow the instructions below π
π No data is collected!
-
Start by forking the repository and clone it to your machine, clone instructions here
-
Create a folder called
assets
in the root of the directory -
Copy the video that you want to use, rename it to
video.mp4
and paste it intoassets
folder- If you have subtitles, rename the file to
subtitles.vtt
and add it into the same folder
- If you have subtitles, rename the file to
-
Download and install
ffmpeg
so you be able to run the next command. You can follow this tutorial to install it in Windows computer. -
Delete all the files inside
assets/previewImages
folder -
Open terminal and execute the following command
ffmpeg -i assets/video.mp4 -vf fps=1/10,scale=120:-1 assets/previewImages/preview%d.jpg
-
Open the app in the browser following this steps:
- Expand
src
directory - Right click on
index.html
file - Chose
Open with Live Server
(If you don't have the extension Live Server installed, you can find it here)
- Expand
-
The final result will be something like this:
Framework that decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. Read the official documentation here.
Set the input as our video.
Declare that we want to use video filters.
Set the video filter with a rate of 1 frame every ten seconds.
Set the preview image width to 120px and the height to be automatically scaled.
Set the output as the folder named assets/previewImages/
. The %d
will increment the number by one every time there is created a new file.
- Play
- Pause
- Change volume
- Move forward
- Move backwards
- Playback speed
- Captions (if no subtitles are loaded the captions button is hidden)
- Full screen
- Theater mode
- Picture in picture
Create and go to the directory where you want to place the repository
cd my-directory
Clone the project
git clone https://github.com/pncsoares/youtube-video-player-clone.git
Go to the project directory
cd youtube-video-player-clone
Open in Visual Studio Code
code .
MIT