Class: JekyllVideo::Video
- Inherits:
-
JekyllSupport::JekyllTag
- Object
- JekyllSupport::JekyllTag
- JekyllVideo::Video
- Defined in:
- lib/video.rb
Overview
This class implements the Jekyll video functionality
Constant Summary collapse
- PLUGIN_NAME =
'video'.freeze
- VERSION =
JekyllVideo::VERSION
Instance Method Summary collapse
Instance Method Details
#render_impl ⇒ void
This method returns an undefined value.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/video.rb', line 28 def render_impl classes = @helper.parameter_specified?('classes') || 'shadow rounded' src = @helper.parameter_specified?('src') || @argument_string style = @helper.parameter_specified?('style') || '' width = @helper.parameter_specified?('width') || '100%' remote_video = src.start_with?('http') local_video_exists = !remote_video && File.exist?(src) raise VideoError, "Video file at #{src} referenced by #{@page['path']} does not exist." unless remote_video || local_video_exists " <video class=\"jekyll_video \#{classes}\" controls width=\"\#{width}\" style=\"\#{style}\">\n <source src=\"\#{src}\">\n\n Your browser does not support HTML video.\n Here is a <a href=\"\#{src}\">link to the video</a>.\n </video>\n END_OUTPUT\nrescue VideoError => e # jekyll_plugin_support handles StandardError\n e.shorten_backtrace\n msg = format_error_message e.message\n @logger.error { \"\#{e.class} raised \#{msg}\" }\n binding.pry if @pry_on_video_error # rubocop:disable Lint/Debugger\n raise e if @die_on_video_error\n\n \"<div class='jekyll_video_error'>\#{e.class} raised in \#{@tag_name} tag\\n\#{msg}</div>\"\nend\n" |