Skip to content

Commit

Permalink
[DEMAD-104] Video player
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Blazquez Garcia committed Dec 18, 2020
1 parent 6b1e411 commit 83615ce
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ gem 'starrr'
gem 'paperclip-ffmpeg'
gem 'paperclip-av-transcoder'
gem "cocaine"
gem 'jw_player_helper'

source "https://rails-assets.org" do
gem "rails-assets-leaflet"
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ GEM
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (2.3.1)
jw_player_helper (0.0.1)
jwt (1.5.6)
kaminari (1.1.1)
activesupport (>= 4.1.0)
Expand Down Expand Up @@ -594,6 +595,7 @@ DEPENDENCIES
jquery-fileupload-rails
jquery-rails (~> 4.3.3)
jquery-ui-rails (~> 6.0.1)
jw_player_helper
kaminari (~> 1.1.1)
knapsack_pro (~> 1.1.0)
launchy (~> 2.4.3)
Expand Down
12 changes: 10 additions & 2 deletions app/assets/javascripts/imageable.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,19 @@ App.Imageable =
$(data.errorContainer).append(errors)

setPreview: (data) ->
# video_preview = "<div class='small-12 column text-center image-preview'><video width='320' height='240' controls><source src='#{data.result.attachment_url}' class='cached-image' type='video/mp4'>No se muestra el video</video></div>"
video_preview = "<video id='player' playsinline controls><source src='#{data.result.attachment_url}' type='video/mp4'></video>"
image_preview = "<div class='small-12 column text-center image-preview'><figure><img src='#{data.result.attachment_url}' class='cached-image'></figure></div>"
if $(data.preview).length > 0
$(data.preview).replaceWith(image_preview)
if "mp4".indexOf(data.result.filename)
$(data.preview).replaceWith(video_preview)
else
$(data.preview).replaceWith(image_preview)
else
$(image_preview).insertBefore($(data.wrapper).find(".attachment-actions"))
if "mp4".indexOf(data.result.filename)
$(video_preview).insertBefore($(data.wrapper).find(".attachment-actions"))
else
$(image_preview).insertBefore($(data.wrapper).find(".attachment-actions"))
data.preview = $(data.wrapper).find(".image-preview")

doDeleteCachedAttachmentRequest: (url, data) ->
Expand Down
1 change: 1 addition & 0 deletions app/views/welcome/_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%= javascript_include_tag 'swfobject' %>
<% if header.present? %>
<hr style="max-width: 100%">
<div>
Expand Down

0 comments on commit 83615ce

Please sign in to comment.