vime-js / vime

Customizable, extensible, accessible and framework agnostic media player. Modern alternative to Video.js and Plyr. Supports HTML5, HLS, Dash, YouTube, Vimeo, Dailymotion...
https://vimejs.com
MIT License
2.75k stars 154 forks source link

Video source will never be requested under a rare condition #333

Open biaocy opened 1 year ago

biaocy commented 1 year ago

Hi there! I'm just start using vimejs today.

Ran into an minor issue which the player will never request the source when the entire html has no script tag. ( This is rather a rare case )

The bug triggering code was https://github.com/vime-js/vime/blob/1c5482eccd03be67a32a1589c023ce5d6194a9fd/packages/core/src/utils/network.ts#L53-L64

The last line will get a TypeError: Cannot read properties of undefined (reading 'parentNode') when there is no script tag in the entire html.

In this condition, we may need to check if there is a script tag in the html and insert the script elsewhere when it didn't find one.

I can create a PR if you want.

biaocy commented 1 year ago

Ran into this same issue again, and wasted another few hours.