New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Captions being added to DOM multiple times #2525
Comments
Hi @physicsforpoets , I can't access your stream, so it's difficult to investigate.... Nico |
I'm able to load the manifest in the reference player when accessing the reference player via https and using the Playready license - is this what you attempted (as I commented, video playback isn't working for me because I'm in Chrome and it's Playready, but the metadata loads for me and you can scrub and see the caption issues) |
Here in the UK I get a 403 when attempting to retrieve the manifest ... |
Ah, that would explain it, we geoblock content |
@physicsforpoets could you unblock that content, or give us a list of locations where it works so we can use a proxy? EDIT: |
@aescarcha I'm working on getting unprotected content, but removing geoblocking will be an issue - I'm trying to find another Dash manifest with TTML captioning to replicate the issue, it shouldn't be specific to our content - let me see what I can figure out today, apologies |
I'm now starting to think that this is not an issue with rendering the tracks, but an issue with the imsc library parsing the TTML - If there are 2 cues active on screen at any given time, the video element's activeCues array contains two VTTCue objects - each of these VTTCue objects contains an ISD object with a 'contents' array that contains ISDContentElements that represent BOTH cues. When using the Shaka player, on a cue change the activeCues array contains 2 top level VTTCue objects with 1 instance of each cue's content: TTML:
Dash.js / imscJS parsed:
Shaka parsed:
This doubled up cue behavior does not seem to occur when there is only a single active cue, hence me thinking it's a bug in the imsc parsing: Only a pop1:
Dash/ismc parsed:
EDIT: Actually this reinforces my my thought in my initial post that the logic in TTMLParser is incorrect. Instead of for-looping through isd.contents.length and pushing the isd object into the captionArray (lines 128-134), it seems that either the for loop should be skipped - which would produce a single VTTCue object with each active cue inside isd.contents - or continue to perform the loop, but instead of pushing the entire isd object into the captionArray, push isd.contents[j] - which would produce a VTTCue for each value inside of isd.contents, but I believe this would screw up the visual output. |
I've got an updated manifest where you can see the issue occuring:
You can see the full contents of each isd being added to the DOM as many times as the length of isd.contents - you can also see the errant behavior by observing a text track's active cues. Additionally you can see 2 cues enter and exit each time there are 2 active cues, but again, these 2 cues both contain the same 2 TTML cues. |
Hi @physicsforpoets , I can't access that mpd either, I get a 403 Forbidden. |
@aescarcha it's still going to be geoblocked outside of the US, this is just unencrypted so you won't have to deal with license requests or timeouts |
It's probably worth remembering that since the VTTCue is being used by dash.js for timing and as a data carrier for the ISD, it's fine for all the displayed contents of each ISD to be in a single ISD, even if that covers multiple regions. Shaka adopts a completely different approach, effectively transcoding the TTML into VTT and potentially dropping some important information along the way (I can't see what's in the I'm outside the US so get blocked trying to open that MPD - @physicsforpoets is there any way to open this up so people wanting to help can actually do so? Or even attach more of the TTML? Can you construct a simple test case that demonstrates the problem and can be shared? Without being able to see the whole TTML it is hard to provide more info about this specific issue. For example I can't see from #2525 (comment) if there is genuinely duplicated content in adjacent ISDs that is correctly leading to the observed behaviour, and I can't see the cue times. Also, the cues should not both be visible simultaneously, so all the more reason for being able to see the begin and end times of each cue when debugging this. What is the visible result? Can you attach a screenshot? |
@nigelmegitt opening up the geoblocking is out of my control, apologies. I understand Shaka is using a completely different system, I was just checking it as a comparison as it's our current player. Visually by default, there is no visible issue because the contents of the 2nd VTTCue are visually rendered outside of the player container (do an inspect element on the 2nd inside of the captioning div when 2 cues are visible at once.)
Here is a brief summary of the issues:
I'll grab screenshots of the full activeCues output that I abridged ( Here is the full TTML chunk that I pulled the above sample from - notice the captions that I clipped out do not appear twice in this XML, but appear twice in activeCues and the div.
|
Here is the DOM while 2 cues are active at the same time - note the 2 cues are present twice:
|
Here is the output of textTracks[0].activeCues while there are 2 cues visible at once - notice there are 2 sets of pop1's and pop2's with the same contents:
|
I can reproduce this locally - it's definitely a bug. The thing I was missing is that the duplicate set of cues are not displayed because of the styling, but, as pointed out, they are definitely active. The answer does appear to be that one ISD should map to one cue, as alluded to above. I think the original test here was to ensure only cues with actual content were created, but I suspect there wasn't any multiple active cue content available when the initial integration was completed. I'll submit a patch shortly. |
Thanks @bbcrddave - that answers my #2525 (comment) earlier. |
Fix #2525 - map one ISD to one Cue, not one Cue per content element
Environment
Link to playable MPD file:
https://dash-vod.cdn1.showtimeanytime.com/dash/v2/affairffetvma_3437300_20180101_20180630_122717/tv_master_sdk.mpd
Widevine License: https://www.showtimeanytime.com/common/drm-certs/cert_license_widevine_com.bin?refid=XPPK0001513852719000&authToken=0:f3b6c81d-67eb-4c59-8f2b-93b2f22f87f8&sd=true
Playready License: https://www.qa-maint.sho.com/api/drm/playready/license
(I could not get video playback working in the reference player - I assume it's a license issue - but if you scrub to 38:02 you can see the issue occuring)
Dash.js version: 2.6.7
Browser name/version: Chrome 65...
OS name/version: MacOS 10.13.3
Steps to reproduce
Playback video with captions where any cue contains multiple simultaneous captions.
Observed behaviour
Caption text is being added twice to the DOM in two separate cue_TTML_xxx div's. Pulling down the debug player, the errant code appears to be here:
Removing the for(j) loop and skipping right to if (startTime < endTime) appears to fix the issue - I do not understand the original intent behind adding the entire isd object to the captionArray X times, where X is the length of the isd.contents array.
Console output
Output
``` Paste the contents of the browser console here. You may need to enable debug logging in dash.js by calling player.getDebug().setLogToBrowserConsole(true) if you are using your own page. ```EDIT: Updated to fix code snippet readability
The text was updated successfully, but these errors were encountered: