Plays a Mux video in Angular with Video.js 10 and loads the player only when it is shown.
src/app/video-player.tsimports the Video.js elements it uses (@videojs/html/video/player,@videojs/html/video/skin,@videojs/html/media/mux-videoand@videojs/html/extensions/mux-data) and addsCUSTOM_ELEMENTS_SCHEMA.src/app/app.tsrenders that component inside@defer.@deferonly lazy-loads Angular components, so the imports live in this wrapper component. Angular puts it and Video.js in a lazy chunk that loads only when the user clicks Load video.<mux-video>takes the Mux source object through a property binding:[source]="{ playbackId }". It fires the standard media events, so(play)and(pause)work like they do on<video>.<mux-data>turns on Mux Data monitoring. It readsmetadata-*attributes such asmetadata-video-titleandmetadata-viewer-user-id.
npm install
npm startThen open http://localhost:4200.