Collections functions
General functions
Render functions
Theme permission functions
Resource functions

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 56 to 81

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 htmlspecialchars($video_altfile["path"]) ?>" label=" echo htmlspecialchars($video_altfile["description"]); ?>" ></track>
                
                
}
            }
        }
    }

This article was last updated 28th November 2022 05:05 Europe/London time based on the source file dated 10th November 2021 09:45 Europe/London time.