Method: EmbeddedFile::Loader#load_video

Defined in:
lib/asker/loader/embedded_file/loader.rb

#load_video(value, localdir) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/asker/loader/embedded_file/loader.rb', line 88

def load_video(value, localdir)
  filepath = File.join(localdir, value)
  output = {}
  output[:text] = '<video controls><source src="@@PLUGINFILE@@/' \
                  + File.basename(filepath) \
                  + '"/>Your browser does not support the video tag.</video>'
  output[:file] = '<file name="' \
                  + File.basename(filepath) \
                  + '" path="/" encoding="base64">' \
                  + Base64.strict_encode64(File.open(filepath, "rb").read) \
                  + "</file>"
  output[:type] = :video
  output[:url] = value
  output
end