fix: refactor video source handling in destroy method to use reset function

This commit is contained in:
Harvey Zhao committed 2025-10-16 15:40:23 +08:00
1 parent b6d0c07f8c
commit 3f47356d2c
1 file changed
+6 -2
+6 -2
View File
@@ -202,11 +202,15 @@ export default class Artplayer extends Emitter {
return this.template.$video return this.template.$video
} }
destroy(removeHtml = true) { reset() {
if (Artplayer.REMOVE_SRC_WHEN_DESTROY) {
this.video.removeAttribute('src') this.video.removeAttribute('src')
this.video.load() this.video.load()
} }
destroy(removeHtml = true) {
if (Artplayer.REMOVE_SRC_WHEN_DESTROY) {
this.reset()
}
this.events.destroy() this.events.destroy()
this.template.destroy(removeHtml) this.template.destroy(removeHtml)
instances.splice(instances.indexOf(this), 1) instances.splice(instances.indexOf(this), 1)