Skip to content

Commit

Permalink
Remove unnecessary method
Browse files Browse the repository at this point in the history
vtt is a property of the resource, so just look for it there rather than on a file, which has to go back to the resource anyway
  • Loading branch information
jcoyne committed Nov 17, 2023
1 parent 1a83f2f commit 785f63e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/components/embed/media_tag_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ def enabled_streaming_sources
def transcript
return unless render_captions?

tag.track(src: file.vtt.file_url, kind: 'captions', srclang: 'en', label: 'English')
tag.track(src: @resource.vtt.file_url, kind: 'captions', srclang: 'en', label: 'English')
end

def render_captions?
@include_transcripts && file.vtt
@include_transcripts && @resource.vtt
end

# NOTE: This is only for the legacy media player. We can remove it when we switch to the new player.
Expand Down
4 changes: 0 additions & 4 deletions app/models/embed/purl/resource_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ def thumbnail?
Settings.resource_types_that_contain_thumbnails.include?(resource.type)
end

def vtt
resource.files.find(&:vtt?)
end

def vtt?
mimetype == 'text/vtt'
end
Expand Down

0 comments on commit 785f63e

Please sign in to comment.