Captions are not repositioned / resized when player is resized during a pause
Created by: Gontran-Molotov
- Dash.js version: 2.6.3
Steps to reproduce
- Open v2.6.3 of the Reference Client: http://reference.dashif.org/dash.js/v2.6.3/samples/dash-if-reference-player/index.html
- Play a stream with captions like https://vm2.dashif.org/dash/vod/testpic_2s/multi_subs.mpd
- Pause the player
- Resize the web browser to resize the player
Observed behaviour
Captions are not repositioned / resized according to the new size of the player.
Screenshots
Here is the caption displayed just after the pause. All is correct.
Then here is the same caption after the web browser is slightly resized:
We can see that the caption is no longer centered and its size is not adjusted.
However, when the playback is started again, the next caption is correctly displayed:
Investigation
From my understanding, this bug seems to come from the scaleCue() method of src/streaming/text/textTracks.js
. This method is called by checkVideoSize() as soon as the size of the video changes. This is checked every 500ms by an interval set in setCurrentTrackIdx.
The scaleCue()
method does nothing because the activeCue
passed in parameter has a cellResolution
property set to undefined
. This code is no longer adapted for the imscJS library used since versions 2.6.x.
The activeCue
object has an isd
property containing data about the captions to display but those data are computed values for the previous size of the player. To compute new values for the new size, the original TTML/XML data (as passed to the parse() method of src/streaming/utils/TTMLParser.js) could be set to a property of the cue, and maybe used in cue.onenter() to generate the isd
object only when the caption is currently rendered.
What do you think?