Skip to content

Commit

Permalink
improve the compatibility of mediaSrc value access
Browse files Browse the repository at this point in the history
  • Loading branch information
jhonatangcavalcanti committed Aug 4, 2024
1 parent cd98207 commit ac1c666
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controller/buffer-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1197,5 +1197,7 @@ function addSource(media: HTMLMediaElement, url: string) {
}

function getSourceChild(media: HTMLMediaElement): HTMLSourceElement | null {
return media.querySelector('source');
const sourceChild = media.querySelector?.('source');
if (!sourceChild) return media.firstChild as HTMLSourceElement | null;
return sourceChild;
}

0 comments on commit ac1c666

Please sign in to comment.