-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Force display of subtitles to work around a TV bug #4032
Comments
Does this example display subtitles on your tv http://reference.dashif.org/dash.js/latest/samples/captioning/caption_vtt.html |
Hi @YannickFuereder It's doesn't work. Subtitles not showing. But I have to set the default attribute to true for it to work. |
if the cue events work you could use something like this to display subtitles in a div oncuechange function changeSubtitle(id) {
if (lang == -1) {
video.textTracks[0].mode = "disabled";
document.getElementById('subtitle').innerHTML = "";
} else {
player.setTextTrack(id);
updateSubs(id);
}
}
function updateSubs(id) {
video.textTracks[id].mode = "hidden";
video.textTracks[id].addEventListener('cuechange', function (e) {
if (!player.isTextEnabled()) {
return;
}
if (video.textTracks[id].activeCues.length > 0) {
document.getElementById('subtitle').innerHTML = video.textTracks[id].activeCues[0].text;
} else {
document.getElementById('subtitle').innerHTML = "";
}
});
} add this div to your html <div id="subtitle" class="subtitles"></div> |
@jeugeneDS feel free to close this issue if it works |
Implemented custom rendering in #4089 |
Link to Dashjs slack channel, One of the largest HbbTV manufacturer's device, similar problem having a If forking a quick debug version
|
Hi,
I'm a developer on HbbTV platform.
There is a bug with some HBBTV 2.0 TVs where activating subtitles never works (mode = "showing" does nothing and stays "hidden").
I don't think it comes from Dash.js because if I activate it myself manually it doesn't work either.
The methods
dashPlayer.setTextTrack(0);
anddashPlayer.enableText(true);
do not work either.It's not related to the stream because I tested a lot of different streams:
Even if the textTrack is hidden the
cue.onter
andcue.onexit
events still workSo as a workaround I had to modify these checks in the event listener
cue.onenter
(inaddCaption()
) so that it does not check if the textTrack is indeed active:if(track.mode === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT_SHOWING){
After changing this line, for TTML subtitles it works fine. Dash.js creates the HTML elements, inserts the text into them and the subtitles appear.
But for WebVTT it's not enough, because apparently Dash.js lets the browser manage everything!?
Questions:
mode
property is sometimes readonly?The goal for me is that Dash.js always loads, manages and displays the 1st subtitle, even if the browser says it's not enabled
I included my modified dash.js file:
dash.all.debug.zip
Thank for your support
The text was updated successfully, but these errors were encountered: