zhw2590582 / ArtPlayer

:art: ArtPlayer.js is a modern and full featured HTML5 video player
https://artplayer.org
MIT License
2.55k stars 269 forks source link

Starting from 5.1.4 npm release, assToVtt generates incorrect VTT format #763

Closed HFO4 closed 4 months ago

HFO4 commented 4 months ago

Expected behaviour

assToVtt should generates correct format like below

WEBVTT

1
00:00:00.000 --> 00:00:05.000
This is a test of the ASS format and some basic features in it.

2
00:00:05.000 --> 00:00:07.000
This and the previous line should both show at the bottom of the video in 20 pixel high white Arial with a 2 pixel black outline and 2 pixel offset shadow. This line is long so it should automatically be broken into several lines that are approximately even length, with upper lines being longer.

Actual behaviour

The generated VTT missing End of line \n\n:

WEBVTT 1 00:00:00.000 --> 00:00:05.000 This is a test of the ASS format and some basic features in it.

2 00:00:05.000 --> 00:00:07.000 This and the previous line should both show at the bottom of the video in 20 pixel high white Arial with a 2 pixel black outline and 2 pixel offset shadow. This line is long so it should automatically be broken into several lines that are approximately even length, with upper lines being longer.

The borowser cannot parse such VTT format, so not subtitle shown for ASS files anymore.

Steps to reproduce

You can inspect dist from 5.1.4, the line break \n\n is somehow missing in assToVtt, but it did appears in srtToVtt:

image

Environment

Console errors (if any)

None

Link to where the bug is happening

None

zhw2590582 commented 4 months ago

Fixed in artplayer@5.1.5

HFO4 commented 4 months ago

Comfirm it's fixed. Thanks!