weizhenye / ASS

A lightweight JavaScript ASS subtitle renderer
https://ass.js.org
MIT License
534 stars 79 forks source link

Bug: viewBox="0 0 0 0" crash the page #36

Closed everpcpc closed 5 months ago

everpcpc commented 1 year ago

ASS file with no PlayerResX and PlayerResY would result in svg viewBox="0 0 0 0" if using self created container, and subtitle not showing. Furthermore, after setting ScaledBorderAndShadow to yes, browser crashes on the first cue.

weizhenye commented 5 months ago

https://github.com/weizhenye/ASS/blob/4e774850a1d660e6e12f40cb531b74e26c3c2eac/src/internal/init.js#L50-L53

Script resolution will be set to video resolution if there is no PlayResX and PlayResY, it should not be resulting viewBox="0 0 0 0", can you provide a sample ASS file?

everpcpc commented 5 months ago

Dogville.2003.1080p.BluRay.H264.AAC-RARBG.zip

weizhenye commented 5 months ago
image

It seems no error when loaded in https://ass.js.org/ , anything else I missed here?

everpcpc commented 5 months ago

if using self created container

Maybe this is the difference?

weizhenye commented 5 months ago

After testing, container is not the reason.

Maybe it's because the video is still loading and the loadedmetadata event is not fired yet, so video.videoWidth is 0.