display_video_subtitles()

Description

Generate HTML to display subtitles in playback of a video resource.

Parameters

ColumnTypeDefaultDescription
$ref int Resource ID
$access int Resource access level - e.g. 0 for open access

Return

void

Location

include/video_functions.php lines 66 to 87

Definition

 
function display_video_subtitles($ref$access)
{
    global 
$alt_files_visible_when_restricted;
    
$alt_access hook("altfilesaccess");

    if (
$access == || $alt_files_visible_when_restricted) {
        
$alt_access true# open access (not restricted)
    
}

    if (
$alt_access) {
        
$video_altfiles get_alternative_files($ref);

        foreach (
$video_altfiles as $video_altfile) {
            if (
mb_strtolower($video_altfile["file_extension"]) == "vtt") {
                
$video_altfile["path"] = get_resource_path($reffalse''true$video_altfile["file_extension"], -11false''$video_altfile["ref"]);
                
?>
                <track class="videojs_alt_track" kind="subtitles" src=" echo escape($video_altfile["path"]) ?>" label=" echo escape($video_altfile["description"]); ?>" ></track>
                
            
}
        }
    }
}

This article was last updated 13th July 2025 09:05 Europe/London time based on the source file dated 13th May 2025 11:50 Europe/London time.