Skip to content

Commit

Permalink
feat(player): include provider in can play event detail
Browse files Browse the repository at this point in the history
  • Loading branch information
mihar-22 committed Nov 10, 2023
1 parent f5c9c67 commit 15a70d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/vidstack/src/core/api/media-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export interface MediaCanLoadEvent extends MediaEvent<void> {
export interface MediaCanPlayEvent extends MediaEvent<MediaCanPlayDetail> {}

export interface MediaCanPlayDetail {
provider: MediaProviderAdapter;
duration: number;
buffered: TimeRanges;
seekable: TimeRanges;
Expand Down
8 changes: 7 additions & 1 deletion packages/vidstack/src/core/state/media-player-delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ export class MediaPlayerDelegate {

if (peek($state.canPlay)) return;

this._dispatch('can-play', { detail: info, trigger });
this._dispatch('can-play', {
detail: {
...info,
provider: peek(this._media.$provider)!,
},
trigger,
});
tick();

if (__DEV__) {
Expand Down

0 comments on commit 15a70d3

Please sign in to comment.