Skip to content

Commit 0009f56

Browse files
committed
Add setSource method
1 parent 2d8cc06 commit 0009f56

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
@@ -294,6 +294,7 @@ The player instance exposes the following methods, accessible when the player is
294294
| `mute()` | - | - | Mute the volume |
295295
| `unMute()` | - | - | Unmute the volume |
296296
| `seekTo(time)` | `Number` | - | Seek to a current time in seconds |
297+
| `setSource(source)` | `String` | - | Set the media source |
297298
| `requestFullscreen()` | - | - | Request the fullscreen |
298299
| `exitFullscreen()` | - | - | Exit the fullscreen |
299300
| `getInstance()` | - | - | Get the player instance |

src/core/player.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,15 @@ export default class Player {
477477
this.methodSeekTo(newTime)
478478
}
479479

480+
/**
481+
* Set the media source
482+
* @param source New media source URL
483+
*/
484+
setSource(source: string) {
485+
this.media.src = source;
486+
this.media.load();
487+
}
488+
480489
/**
481490
* Request the fullscreen
482491
*/

0 commit comments

Comments
 (0)