diff --git a/README.md b/README.md index 2b710aed..3de57eaa 100644 --- a/README.md +++ b/README.md @@ -269,6 +269,7 @@ new Vlitejs('#player', { | `progress` | Sent periodically to inform interested parties of progress downloading the media. | | `timeupdate` | Sent when the `currentTime` of the media has changed | | `volumechange` | Sent when audio volume changes | +| `sourcechange` | Sent when source changes | | `enterfullscreen`¹ | Sent when the video switches to fullscreen mode | | `exitfullscreen`¹ | Sent when the video exits fullscreen mode | | `ended` | Sent when playback completes | @@ -303,6 +304,7 @@ The player instance exposes the following methods, accessible when the player is | `getDuration()` | - | `Promise` | Get the duration | | `mute()` | - | - | Mute the volume | | `unMute()` | - | - | Unmute the volume | +| `setSource(source)` | `String` | - | Set the new media source | | `seekTo(time)` | `Number` | - | Seek to a current time in seconds | | `requestFullscreen()` | - | - | Request the fullscreen | | `exitFullscreen()` | - | - | Exit the fullscreen | diff --git a/biome.json b/biome.json index f85c032a..0938baf7 100644 --- a/biome.json +++ b/biome.json @@ -7,7 +7,7 @@ }, "files": { "ignoreUnknown": false, - "includes": ["**"] + "includes": ["**", "!examples/**/*.html"] }, "formatter": { "enabled": true, diff --git a/examples/audio/config.js b/examples/audio/config.js index e35e1f8f..6dbdd7d6 100644 --- a/examples/audio/config.js +++ b/examples/audio/config.js @@ -2,6 +2,7 @@ import '../../dist/vlite.css' import '../../dist/plugins/volume-bar.css' import VlitejsVolumeBar from '../../dist/plugins/volume-bar.js' import Vlitejs from '../../dist/vlite.js' +import { changeSourceEvent } from '../shared/utils.js' Vlitejs.registerPlugin('volume-bar', VlitejsVolumeBar) @@ -24,6 +25,9 @@ new Vlitejs('#player', { player.on('progress', () => console.log('progress')) player.on('timeupdate', () => console.log('timeupdate')) player.on('volumechange', () => console.log('volumechange')) + player.on('sourcechange', () => console.log('sourcechange')) player.on('ended', () => console.log('ended')) + + changeSourceEvent({ player }) } }) diff --git a/examples/audio/index.html b/examples/audio/index.html index 69e6eaa2..67f47549 100644 --- a/examples/audio/index.html +++ b/examples/audio/index.html @@ -8,5 +8,6 @@
+ <%= require('html-loader!../shared/change-source.html').default %>