Reputation: 1
Is there a way to configure the MediaElement.js video player so the captions would be on by default? Thanks.
Upvotes: 0
Views: 3037
Reputation: 752
Looks like it's also possible to do this after the fact, and with isolated videos, with the setTrack function.
var valueOfCaptionsInputElement = 'en';
player.setTrack(valueOfCaptionsInputElement);
Source: https://github.com/mediaelement/mediaelement/blob/master/docs/usage.md#captions
Update: The documentation suggested the id of input element, but in looking at the source code of my version, value was used, so I adjusted and the above code worked for me.
Upvotes: 0
Reputation: 11
There is a parameter startLanguage which appears to default the captions to the specified language and switch them on. Works for me, but doesn't appear to be heavily documented. Only mention on the mediaelementjs site is in the example for Auto-Translation of track elements.
Syntax is:
$('video').mediaelementplayer({
// other media element settings.....
// start with English automatically turned on
startLanguage: 'en'
});
Upvotes: 1