Skip to content

Commit 1f5dbb8

Browse files
rtrittoyoriiis
authored andcommitted
Add setSource method
1 parent 0b008b7 commit 1f5dbb8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ The player instance exposes the following methods, accessible when the player is
304304
| `mute()` | - | - | Mute the volume |
305305
| `unMute()` | - | - | Unmute the volume |
306306
| `seekTo(time)` | `Number` | - | Seek to a current time in seconds |
307+
| `setSource(source)` | `String` | - | Set the media source |
307308
| `requestFullscreen()` | - | - | Request the fullscreen |
308309
| `exitFullscreen()` | - | - | Exit the fullscreen |
309310
| `getInstance()` | - | - | Get the player instance |

src/core/player.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,15 @@ export default abstract class Player {
472472
this.methodSeekTo(newTime)
473473
}
474474

475+
/**
476+
* Set the media source
477+
* @param source New media source URL
478+
*/
479+
setSource(source: string) {
480+
this.media.src = source
481+
this.media.load()
482+
}
483+
475484
/**
476485
* Request the fullscreen
477486
*/

0 commit comments

Comments
 (0)