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,18 +25,18 @@ $(function () { | ||
25 | var totalSteps = $("#vlibras-wizard .content section").size(); | 25 | var totalSteps = $("#vlibras-wizard .content section").size(); |
26 | 26 | ||
27 | if ((priorIndex === 0) && (currentIndex === 1)) { | 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 | if ((priorIndex === 1) && (currentIndex === 2)) { | 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 | if ((priorIndex === 2) && (currentIndex === 3)) { | 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 | if ((currentIndex + 1) === totalSteps) { | 42 | if ((currentIndex + 1) === totalSteps) { |
app/helpers/application_helper.rb
@@ -50,17 +50,24 @@ module ApplicationHelper | @@ -50,17 +50,24 @@ module ApplicationHelper | ||
50 | options = args.first || {} | 50 | options = args.first || {} |
51 | 51 | ||
52 | options[:id] = id | 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 | content_tag(:video, options) do | 55 | content_tag(:video, options) do |
56 | if url.class == String | 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 | else | 58 | else |
59 | url.each do |v| | 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 | end | 61 | end |
62 | end | 62 | end |
63 | end | 63 | end |
64 | end | 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 | end | 73 | end |
app/views/v_libras/requests/_position_step.haml
@@ -21,4 +21,6 @@ | @@ -21,4 +21,6 @@ | ||
21 | 21 | ||
22 | var VLibrasPosition = new VLibrasLocalization(); | 22 | var VLibrasPosition = new VLibrasLocalization(); |
23 | VLibrasPosition.init("#position-step", optionsPosition); | 23 | VLibrasPosition.init("#position-step", optionsPosition); |
24 | + | ||
25 | + videojs("id-4", { "controls": false, "autoplay": false, "preload": "true", "width": 940, "height": 530 }); | ||
24 | }); | 26 | }); |
25 | \ No newline at end of file | 27 | \ No newline at end of file |
app/views/v_libras/requests/_service_step.haml
@@ -25,5 +25,7 @@ | @@ -25,5 +25,7 @@ | ||
25 | 25 | ||
26 | var VLibrasSubAudio = new VLibrasLocalization(); | 26 | var VLibrasSubAudio = new VLibrasLocalization(); |
27 | VLibrasSubAudio.init("#service-step", optionsService); | 27 | VLibrasSubAudio.init("#service-step", optionsService); |
28 | + | ||
29 | + videojs("id-2", { "controls": false, "autoplay": false, "preload": "true", "width": 940, "height": 530 }); | ||
28 | }); | 30 | }); |
29 | 31 |
app/views/v_libras/requests/_size_step.haml
@@ -20,5 +20,7 @@ | @@ -20,5 +20,7 @@ | ||
20 | 20 | ||
21 | var VLibrasSize = new VLibrasLocalization(); | 21 | var VLibrasSize = new VLibrasLocalization(); |
22 | VLibrasSize.init("#size-step", optionsSize); | 22 | VLibrasSize.init("#size-step", optionsSize); |
23 | + | ||
24 | + videojs("id-3", { "controls": false, "autoplay": false, "preload": "true", "width": 940, "height": 530 }); | ||
23 | }); | 25 | }); |
24 | 26 |
app/views/v_libras/requests/_video_step.haml
1 | #video-step.wrapper | 1 | #video-step.wrapper |
2 | - .video_wrapper | ||
3 | - | ||
4 | = html5_video_tag(['/system/videos/workflow/sub_audio.webm', '/system/videos/workflow/sub_audio.mp4'], 'id-1', 'video-wizard') | 2 | = html5_video_tag(['/system/videos/workflow/sub_audio.webm', '/system/videos/workflow/sub_audio.mp4'], 'id-1', 'video-wizard') |
5 | 3 | ||
6 | .row-fluid | 4 | .row-fluid |
@@ -22,5 +20,5 @@ | @@ -22,5 +20,5 @@ | ||
22 | var VLibrasVideo = new VLibrasLocalization(); | 20 | var VLibrasVideo = new VLibrasLocalization(); |
23 | VLibrasVideo.init("#video-step", optionsVideo); | 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 | \ No newline at end of file | 25 | \ No newline at end of file |