Default subtitle for videos

admin2025-01-07  3

How can I set the default subtitle in wordpress videos?

Here is the shortcode that wp created after adding a video with a subtitle from media:

[video 
    width="960" 
    height="540" 
    mp4="example/wp-content/uploads/test.mp4"
]<track 
    srclang="En" 
    label="English" 
    kind="subtitles" 
    src="example/wp-content/uploads/test.vtt" 
/>[/video]

Now when I see the post in FO, I have to click on "cc" in video control bar and choose "English". The default is "None".

Now how can I change this default to English so that the user doesn't have to choose subtitle?

How can I set the default subtitle in wordpress videos?

Here is the shortcode that wp created after adding a video with a subtitle from media:

[video 
    width="960" 
    height="540" 
    mp4="example.com/wp-content/uploads/test.mp4"
]<track 
    srclang="En" 
    label="English" 
    kind="subtitles" 
    src="example.com/wp-content/uploads/test.vtt" 
/>[/video]

Now when I see the post in FO, I have to click on "cc" in video control bar and choose "English". The default is "None".

Now how can I change this default to English so that the user doesn't have to choose subtitle?

Share Improve this question edited Jun 27, 2017 at 17:02 Johansson 15.4k11 gold badges43 silver badges79 bronze badges asked Jun 27, 2017 at 13:07 Amirhossein RzdAmirhossein Rzd 101
Add a comment  | 

2 Answers 2

Reset to default 0

From a UX perspective whether to display a subtitle track is a preference that should really be left up to the user.

Edit: that being said, mediaelement.js allows you to specify a starting sub track by passing in this option:

{ startLanguage: 'en' }

With jQuery click on subtitle label

"en" srclang value.

if ($('#mep_0_track_0_subtitles_en').length > 0) 
    $('#mep_0_track_0_subtitles_en').trigger('click');
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736256867a395.html

最新回复(0)