Class: Video
- Defined in:
- app/models/video.rb
Instance Method Summary collapse
-
#as_json(options = nil) ⇒ Object
JSON, special edition for video files.
Methods inherited from Document
#format, lookup_subtype_class, #mime_type, #mime_type_type_sym, new
Instance Method Details
#as_json(options = nil) ⇒ Object
JSON, special edition for video files
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/models/video.rb', line 18 def as_json( = nil) { :id => id, :title => title, :description => description, :author => .name, :poster => URI.join([:helper].root_url, file.url(:poster)).to_s, :sources => [ { type: Mime::WEBM.to_s, src: URI.join([:helper].root_url, file.url(:webm)).to_s }, { type: Mime::MP4.to_s, src: URI.join([:helper].root_url, file.url(:mp4)).to_s }, { type: Mime::FLV.to_s, src: URI.join([:helper].root_url, file.url(:flv)).to_s } ] } end |