We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Add-Ons
default app icon

Captions

By Blair Liikala
Integrations
Free

Description

Make working with captions easier. Display captions as HTML within EE templates.

Description

Take caption files and use them in ExpressionEngine templates.

Uses the subtitles project.

Find the repo on github

Parameters

Name Description
file URL or file path to caption file.
file_id The ExpressionEngine file ID, used to get the server path.
type The format type such as srt or vtt for implicity setting the parser.

Supported formats

Format Extension
SubRip .srt
WebVTT .vtt
Spruce Technologies SubTitles .stl
Youtube Subtitles .sbv
SubViewer .sub
Advanced Sub Station .ass
DFXP .dfxp
TTML .ttml

SRT or VTT tend to work the best. Some WebVTT formats may include extra metadata that might break the parsing (YouTube). In this case try the SRT or SBV caption files.

render Tags

Name Description
text The subtitle or caption text of the cue.
start Time in seconds that the cue starts.
end Time in seconds that the cue ends.
start_timecode Timecode that the cue starts in HH:MM:SS
end_timecode Timecode that the cue end in HH:MM:SS
raw JSON of all the cues

Examples

{exp:ee_captions:render file="/files/caption.vtt"}

<li>{start_timecode} - {text}</li>

{/exp:ee_captions:render}

Using EE Tags

{exp:ee_captions:render file_id="{caption_file}{file_id}{/caption_file}"}

<li>{start_timecode} - {text}</li>

{/exp:ee_captions:render}

Using a custom text field

In this example, the entry field called caption contains a plain textarea field with no formatting with the contents of a caption file. Wrap the field in a <template id="captions"> tag. This HTML tag will hide the captions by default, and be used to render the tag pairs.

{exp:channel:entries channel="blog"}
  {exp:ee_captions:render type="vtt"}
    <template id="captions">
      {caption}
    </template>
    <li>{start_timecode} - {text}</li>
  {/exp:ee_captions:render}
{/exp:channel:entries}

Changelog

1.2

  • Fixed naming issue.

1.1

  • Added the file_id option.
  • Added the template opion.

1.0 Initial Release

Information
Version 1.2
Last Update 2 years ago
Compatibility EE 7
License MIT
Links
  • Support
Free
ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.