A modern looking video player feat. HTML5 Video API
Explore the docs ยป
View Demo
ยท
Report Bug
ยท
Request Feature
Table of Contents
When looking for an online video player for your website, you might hear the names YouTube and Vimeo before any else. Thatโs because these are quick, easy, and free options readily available to you. However, if you want more control over your video assets, how they are displayed, and want to learn how users interact with your content and engage with it, you might need a private HTML5 video player.
Flash-based players have become less popular now and HTML5 video players have become the new industry standard. For facilitating seamless integration on your website, this is suggested best online video player for you! ๐
This is an example of how you may start on setting up your project locally. To get a local copy up and running follow these simple example steps.
This is an example of how to list things you need to use the software and how to install them.
- First of all install
Live Serverextension byRitwick Dey. - Once the extension was installed, then
right-clickonindex.htmland selectOpen with Live Server. - It'll open a new tab in browser & start serving the video player. Enjoy!.
- First of all, we added an SVG as a hero image because an svg can scale upto any size according as the size of the viewport.
- Then added a video element with attribute
playsinlinewhich gonna prevent the video to be played in full screen mode by default on mobile views.
Ui Components:
-
Play Icon, Video, Mobile Responsiveness.
- Making `video` element to take `min-width: 800px` & `max-width: 80vw` and on large smart phone (600px or less), `min-width: 0` & `max-width: 90%`.
- On the click on `play-icon` or on the video, the video starts playing and `play-icon` turn into `pause-icon` & vice-versa. Also, when the current playlist is ended i.e. when `ended` event fires, `pause-icon` turn into `play-icon`.
- Also, on the click at different position on Volume Bar, it'll change current volume. To do that, extract `offsetX` & `offsetWidth` value from Volume Bar element and calculate the percentage of `offsetX` in `offsetWidth`, then update `width` of volume-bar & Change `volume-icon` accordingly.
-
Controls HTML, Show controls on hover
- By default, `control-container` has `opacity` 0 but when hover over it, it'll get opacity of 1 and added animation of style `ease-out` with delay of 2s.
-
Progress Bar - width-increment, hover-effect
- A progress-bar consists of two parts: the `progress-range` & the `progress-bar` itself. We used `calc()` CSS function to set width of `progress-range` and added some `animation` on hover as the `thikness` increases!.
- On the fire of `canPlay`, `timeupdate` events, the values of these properties `currentTime`, `duration` extracted from `video` element and calculated percentage of `currentTime` in `duration` & set it as `width` of Progress-Bar. Followed by `time-elapsed`, `total-duration` update.
- Also, on the click at different position on progress bar, it'll change current playback position. To do that, extract `offsetX` & `offsetWidth` value from Progress Bar element and calculate the percentage of `offsetX` in `offsetWidth`along `duration`, then update `width` of progress-bar, `time-elapsed`, `total-duration` etc.
-
Playback Speed Dropdown
- On change of playback speed, the `change` event fires on `select` element and then `playbackRate` property on video element is set to selected value of Playback Speed Dropdown.
To see in action, please visit to the Link
- Plays anything: Plays โtraditionalโ file formats such as MP4 and WebM, but also supports adaptive streaming formats such as HLS and DASH. Thereโs even a special UI for live streams!
- Easy to style: Designed to be a reliable and consistent base to build on top of. The player looks great out of the box, but can be easily styled with a little bit of extra CSS.
- Supported everywhere: Your video should work everywhere your app does. The team makes an effort to support every modern browser we can, including desktop and mobile.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt for more information.
Prasenjit Sutradhar - @twitter_handle - prasenjitsutradhar3433@gmail.com
Project Link: https://github.com/Prasenjit-3433/Custom-Video-Player

