diff --git a/README.md b/README.md index 669135a4..6c3a7458 100644 --- a/README.md +++ b/README.md @@ -296,6 +296,7 @@ The player instance exposes the following methods, accessible when the player is | `mute()` | - | - | Mute the volume | | `unMute()` | - | - | Unmute the volume | | `seekTo(time)` | `Number` | - | Seek to a current time in seconds | +| `setSource(source)` | `String` | - | Set the media source | | `requestFullscreen()` | - | - | Request the fullscreen | | `exitFullscreen()` | - | - | Exit the fullscreen | | `getInstance()` | - | - | Get the player instance | diff --git a/src/providers/html5/html5.ts b/src/providers/html5/html5.ts index 789eb526..72eb999a 100644 --- a/src/providers/html5/html5.ts +++ b/src/providers/html5/html5.ts @@ -57,6 +57,15 @@ export default function Html5Provider(Player: any) { }) } + /** + * Set the media source + * @param source New media source URL + */ + setSource(source: string) { + this.media.src = source + this.media.load() + } + /** * Create event listeners * All listeners are created on class properties to facilitate the deletion of events