feat: enforce browser environment for Artplayer initialization

- Added a check in the Artplayer constructor to throw an error if instantiated outside a browser environment.
- Updated the isBrowser utility to ensure both window and document are defined.
- Removed unused user agent checks for WeChat, IE, and Android from compatibility utilities.
- Updated TypeScript definitions to reflect the removal of unused properties.
- Added a basic test case for Artplayer initialization in SSR context.
This commit is contained in:
Harvey Zack committed 2025-08-16 21:11:30 +08:00
1 parent 3a2dcdb226
commit e834246641
9 files changed
+14 -14

No files matched your search

+4
View File
@@ -29,6 +29,10 @@ export default class Artplayer extends Emitter {
constructor(option, readyCallback) {
super()
if (!utils.isBrowser) {
throw new Error('Artplayer can only be used in the browser environment')
}
this.id = ++id
const mergeOption = utils.mergeDeep(Artplayer.option, option)