mat-video for Angular 5/6/7/8+ and Material
mat-video is an Angular component for playing videos. It has all the features you would expect from a standard video player, all in an extremely light package. The video player is designed to be flexible and easy to use; you can be up and running in less than 5 minutes!
It was built for modern browsers using TypeScript, CSS3 and HTML5 with Angular & Material 5/6/7/8+.
See the changelog for recent changes.
- Native HTML5 video player
- Easy to use
- Buffering spinners
- Poster image
- Subtitles and text tracks
- Multiple media sources
- Customizable controls
- Material theming
- Keyboard shortcuts
- Fixed and responsive sizing
- Supports Chrome, Firefox, Safari, and Edge
mat-video requires Angular Material as a peer dependency, including animations.
npm install --save @angular/material @angular/cdk @angular/animations hammerjs
Add the following import to
To use mat-video in your project install it via npm:
npm install --save mat-video
Add the following to your module:
Finally, include an Angular Material theme in
styles.css, or via a
<link> element in
A minimal example is quite simple, in your HTML file:
A slightly more customized example, in your HTML file:
|src||string||Path or URL to a video||null|
|title||string||Title for the video||null|
|autoplay||boolean||Whether the video should autoplay||false|
|preload||boolean||Whether the video should preload||true|
|loop||boolean||Whether the video should loop||false|
|time||number (two-way bindable)||Get or set the timestamp of the video||0|
|muted||boolean (two-way bindable)||Get or set whether the video is muted||false|
|quality||boolean||Whether the video will have a quality indicator||true|
|download||boolean||Whether the video will have a download option||false|
|fullscreen||boolean||Whether the video will have a fullscreen option||true|
|showFrameByFrame||boolean||Whether the video will display frame-by-frame controls||false|
|keyboard||boolean||Whether the player will have keyboard shortcuts||true|
|overlay||boolean||Force the overlay/controls to be shown or hidden||null|
|color||ThemePalette||Material theme color palette for the sliders||primary|
|spinner||string||Use 'spin', 'dot', 'split-ring', 'hourglass', or pass your own buffering spinner class||spin|
|poster||string||Path or URL to a poster image||null|
The matVideoSource attribute can be used on the source tag to automatically reload the video when the source changes.
The matVideoTrack attribute can be used on the track tag to automatically reload the video when the track changes.
Listening to video events can be accomplished by directly accessing the video tag within mat-video.
In your HTML file:
In your TS file:
This API feature is considered experimental, and is subject to change.
Angular Compatibility Depreciation Notice (2019-06-14)
Angular is rapidly growing with every major release. This has caused an increasing burden on the development of mat-video to support older versions of Angular. Due to the vast amount of differences between modern Angular and previous Angular versions, mat-video will officially be dropping support for older Angular versions with the upcoming Angular 9 release scheduled for November 2019. Existing releases will continue to function with older versions of Angular, however, no support will be provided for these versions. Instead, mat-video will provide backwards compatibility in a similar way to how Angular supports this. This notice is provided as an opportunity for developers to make necessary upgrades and plans for the future. More details will be announced closer to the release of Angular 9.
mat-video is an open-source project developed by Nicholas Koehler.
Special thanks to mediapack-me for responsive assistance.