Commit Graph
22 Commits
Author SHA1 Message Date
Anıl Çalışkol 0f47e11d63 fix: silence unhandled play() rejections from internal callers
`art.play()` is an async wrapper around the native `video.play()` promise, which
rejects when a pending play request is interrupted (`pause()`, `load()`, a new
`src`, or the element being removed) and when autoplay is blocked.

Every internal caller fires it from an event handler and cannot await it, so the
rejection escapes as a global `unhandledrejection`. Error trackers report it as
an uncaught crash even though the player recovers on its own — for example
destroying the player right after mount, which is routine when the video sits in
a modal the user can close quickly.

Add a `silencePromise` util (the same approach video.js uses) and apply it to the
non-awaited internal call sites: mask, play control, mini player, loop restart,
autoPlayback jump, hotkey and click toggles.

`switchMix` is fixed too, for a second symptom: `await art.play()` inside the
async `video:canplay` handler both leaked the rejection and left the `switchUrl`
promise pending forever, since the throw never reached the enclosing executor's
`reject`. It now settles.

The public API is unchanged: `art.play()` and `art.toggle()` still return the
original promise, so applications that call them keep their own rejection to
handle. Only the internal, non-awaited copy is silenced.
2026-08-30 16:31:40 +03:00
Harvey Zack 35ad9883af build all
Refactor utility functions for improved readability and consistency

- Updated compatibility.js to use consistent line endings and formatting.
- Refactored component.js for better readability and structure, including consistent use of arrow functions and binding.
- Simplified dom.js functions with consistent formatting and improved readability.
- Enhanced emitter.js with consistent formatting and arrow function usage.
- Streamlined error.js for improved readability and consistency.
- Refactored file.js to use consistent formatting and improved readability.
- Improved format.js functions for better readability and consistency.
- Updated index.js to maintain consistent export formatting.
- Refactored property.js for improved readability and consistency.
- Enhanced subtitle.js with consistent formatting and improved readability.
- Refactored time.js for better readability and consistent formatting.

fix: update lint script to target only source files for consistency

Revert "fix: restore export statements for various plugins and update type definitions for better clarity"

This reverts commit b5e969d81ec765cd8a34b06e6ef4f232ef25087f.

fix: restore export statements for various plugins and update type definitions for better clarity

Refactor type definitions to use interfaces instead of type aliases for better extensibility and clarity across i18n, icons, option, player, quality, setting, subtitle, template, and utils modules.
2025-08-03 13:17:33 +08:00
Harvey 2f9e0d49ee add error icon 2022-05-18 13:25:56 +08:00
zhw2590582 146a8c0256 4.3.3 2022-03-16 23:01:07 +08:00
Harvey 415a04a4a7 build all packages 2019-12-09 17:34:55 +08:00
Harvey ee90291897 压缩字符 2019-11-22 17:32:09 +08:00
Harvey 2fcd44e8e7 组件添加add方法 2019-11-22 16:34:31 +08:00
Harvey 1d859e2049 创建组件父类 2019-11-22 15:35:21 +08:00
Harvey 0c1c1273a6 压缩多余字符 2019-11-22 11:10:28 +08:00
Harvey 9f2038539e 优化字幕结构 2019-11-15 10:17:11 +08:00
Harvey 7a84c262da 提取共用方法 2019-11-14 10:11:03 +08:00
Harvey Zack cadfa4efe5 build all packages 2019-06-12 15:24:34 +08:00
Harvey Zack a817034907 typofix 2019-04-30 17:08:34 +08:00
Harvey Zack fa585e536a 调整整体样式 2019-04-30 15:10:30 +08:00
Harvey Zack 487e865017 优化整体结构 2019-04-30 13:06:24 +08:00
Harvey Zack 970e7e3b89 typofix 2018-11-28 18:26:42 +08:00
Harvey Zack 3fb41eedf7 分离template 2018-11-28 12:15:33 +08:00
Harvey Zack 044e75fb73 docs update 2018-11-24 10:34:29 +08:00
Harvey Zack be7b646c31 添加部分可配置图标 2018-11-24 10:23:04 +08:00
Harvey Zack 203ad0d3a0 格式化 2018-11-21 19:45:44 +08:00
Harvey Zack ae548e93c8 bugfix 2018-11-10 11:57:28 +08:00
Harvey Zack 0aa018db6d 修改包管理 2018-11-07 17:12:42 +08:00