Commit 16490cbccc4b706dd39e9581c251dbb3e8be4a49
1 parent
3aba8fe1
Exists in
master
and in
2 other branches
Correct initialization of video.js
Showing
6 changed files
with
23 additions
and
12 deletions
Show diff stats
app/assets/javascripts/v_libras/requests/new.js
| ... | ... | @@ -25,18 +25,18 @@ $(function () { |
| 25 | 25 | var totalSteps = $("#vlibras-wizard .content section").size(); |
| 26 | 26 | |
| 27 | 27 | if ((priorIndex === 0) && (currentIndex === 1)) { |
| 28 | - $("#video-step").find("video")[0].pause(); | |
| 29 | - $("#service-step").find("video")[0].play(); | |
| 28 | + videojs($("#video-step").find("video")[0]).pause(); | |
| 29 | + videojs($("#service-step").find("video")[0]).play(); | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if ((priorIndex === 1) && (currentIndex === 2)) { |
| 33 | - $("#service-step").find("video")[0].pause(); | |
| 34 | - $("#position-step").find("video")[0].play(); | |
| 33 | + videojs($("#service-step").find("video")[0]).pause(); | |
| 34 | + videojs($("#position-step").find("video")[0]).play(); | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if ((priorIndex === 2) && (currentIndex === 3)) { |
| 38 | - $("#position-step").find("video")[0].pause(); | |
| 39 | - $("#size-step").find("video")[0].play(); | |
| 38 | + videojs($("#position-step").find("video")[0]).pause(); | |
| 39 | + videojs($("#size-step").find("video")[0]).play(); | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if ((currentIndex + 1) === totalSteps) { | ... | ... |
app/helpers/application_helper.rb
| ... | ... | @@ -50,17 +50,24 @@ module ApplicationHelper |
| 50 | 50 | options = args.first || {} |
| 51 | 51 | |
| 52 | 52 | options[:id] = id |
| 53 | - options[:class] = "video-js vjs-default skin #{classes}" | |
| 53 | + options[:class] = "video-js vjs-default-skin vjs-big-play-centered #{classes}" | |
| 54 | 54 | |
| 55 | 55 | content_tag(:video, options) do |
| 56 | 56 | if url.class == String |
| 57 | - content_tag(:source, '', :src => (url + "?t=" + Time.now.getutc.to_i.to_s)) | |
| 57 | + content_tag(:source, '', :src => (url + "?t=" + Time.now.getutc.to_i.to_s), :type => mimetype_from_url(v)) | |
| 58 | 58 | else |
| 59 | 59 | url.each do |v| |
| 60 | - concat content_tag(:source, '', :src => (v + "?t=" + Time.now.getutc.to_i.to_s)) | |
| 60 | + concat content_tag(:source, '', :src => (v + "?t=" + Time.now.getutc.to_i.to_s), :type => mimetype_from_url(v)) | |
| 61 | 61 | end |
| 62 | 62 | end |
| 63 | 63 | end |
| 64 | 64 | end |
| 65 | 65 | |
| 66 | + def mimetype_from_url(url) | |
| 67 | + return 'video/mp4' if url.split('.').last == 'mp4' | |
| 68 | + return 'video/webm' if url.split('.').last == 'webm' | |
| 69 | + | |
| 70 | + 'video/mp4' | |
| 71 | + end | |
| 72 | + | |
| 66 | 73 | end | ... | ... |
app/views/v_libras/requests/_position_step.haml
| ... | ... | @@ -21,4 +21,6 @@ |
| 21 | 21 | |
| 22 | 22 | var VLibrasPosition = new VLibrasLocalization(); |
| 23 | 23 | VLibrasPosition.init("#position-step", optionsPosition); |
| 24 | + | |
| 25 | + videojs("id-4", { "controls": false, "autoplay": false, "preload": "true", "width": 940, "height": 530 }); | |
| 24 | 26 | }); |
| 25 | 27 | \ No newline at end of file | ... | ... |
app/views/v_libras/requests/_service_step.haml
app/views/v_libras/requests/_size_step.haml
app/views/v_libras/requests/_video_step.haml
| 1 | 1 | #video-step.wrapper |
| 2 | - .video_wrapper | |
| 3 | - | |
| 4 | 2 | = html5_video_tag(['/system/videos/workflow/sub_audio.webm', '/system/videos/workflow/sub_audio.mp4'], 'id-1', 'video-wizard') |
| 5 | 3 | |
| 6 | 4 | .row-fluid |
| ... | ... | @@ -22,5 +20,5 @@ |
| 22 | 20 | var VLibrasVideo = new VLibrasLocalization(); |
| 23 | 21 | VLibrasVideo.init("#video-step", optionsVideo); |
| 24 | 22 | |
| 25 | - VLibrasVideo.play(); | |
| 23 | + videojs("id-1", { "controls": false, "autoplay": true, "preload": "true", "width": 940, "height": 530 }); | |
| 26 | 24 | }) |
| 27 | 25 | \ No newline at end of file | ... | ... |