Commit 890e9322f10cf6165c5ee876f6349596035456c7

Authored by Fernando Brito
1 parent bbef3f33
Exists in master and in 2 other branches v2, wikilibras

Proper videojs initialization

app/assets/stylesheets/components/video_player.css.scss
@@ -15,8 +15,12 @@ @@ -15,8 +15,12 @@
15 15
16 .video-vlibras { 16 .video-vlibras {
17 max-width: 50%; 17 max-width: 50%;
  18 + margin: auto;
18 } 19 }
19 20
20 -.video-js {  
21 - width: 100%; 21 +.video-js { padding-top: 56.25% }
  22 +.vjs-fullscreen { padding-top: 0px }
  23 +
  24 +#vlibras-wizard {
  25 + .video-js { padding-top: 0px !important; }
22 } 26 }
23 \ No newline at end of file 27 \ No newline at end of file
app/helpers/application_helper.rb
@@ -46,11 +46,14 @@ module ApplicationHelper @@ -46,11 +46,14 @@ module ApplicationHelper
46 :data => { 'toggle' => "tooltip" }, :title => request.response) 46 :data => { 'toggle' => "tooltip" }, :title => request.response)
47 end 47 end
48 48
49 - def html5_video_tag(url, id, classes = nil, *args) 49 + def html5_video_tag(url, id, classes, data_options, *args)
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 vjs-big-play-centered #{classes}" 53 options[:class] = "video-js vjs-default-skin vjs-big-play-centered #{classes}"
  54 + options[:width] = 'auto'
  55 + options[:height] = 'auto'
  56 + options['data-setup'] = data_options
54 57
55 content_tag(:video, options) do 58 content_tag(:video, options) do
56 if url.class == String 59 if url.class == String
@@ -70,4 +73,14 @@ module ApplicationHelper @@ -70,4 +73,14 @@ module ApplicationHelper
70 'video/mp4' 73 'video/mp4'
71 end 74 end
72 75
  76 + def include_videojs_assets
  77 + content_for(:css) do
  78 + stylesheet_link_tag "//vjs.zencdn.net/4.6/video-js.css"
  79 + end
  80 +
  81 + content_for(:js) do
  82 + javascript_include_tag "//vjs.zencdn.net/4.6/video.js"
  83 + end
  84 + end
  85 +
73 end 86 end
app/views/devise/sessions/new.html.haml
  1 += include_videojs_assets
  2 +
1 .row-fluid 3 .row-fluid
2 .span7 4 .span7
3 - = html5_video_tag(['/system/videos/login.webm', '/system/videos/login.mp4'], 'login', 'video-instructions',  
4 - :autoplay => 'autoplay', :loop => 'loop') 5 + = html5_video_tag(['/system/videos/login.webm', '/system/videos/login.mp4'],
  6 + 'login-video', 'video-instructions', '{ "autoplay": true }')
5 7
6 .span4.offset1.login 8 .span4.offset1.login
7 %h2 Entrar 9 %h2 Entrar
app/views/layouts/application.html.erb
@@ -8,11 +8,10 @@ @@ -8,11 +8,10 @@
8 <%= yield :javascript_code %> 8 <%= yield :javascript_code %>
9 9
10 <%= yield :css %> 10 <%= yield :css %>
11 - <%= stylesheet_link_tag "application", :media => "all" %> 11 + <%= stylesheet_link_tag "application", :media => "all" %>
12 12
13 <%= yield :css_code %> 13 <%= yield :css_code %>
14 14
15 -  
16 <%= csrf_meta_tags %> 15 <%= csrf_meta_tags %>
17 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 16 <meta name="viewport" content="width=device-width, initial-scale=1.0">
18 17
@@ -47,9 +46,8 @@ @@ -47,9 +46,8 @@
47 </footer> 46 </footer>
48 </div> 47 </div>
49 48
50 -<link href="//vjs.zencdn.net/4.6/video-js.css" rel="stylesheet">  
51 -<script src="//vjs.zencdn.net/4.6/video.js"></script>  
52 49
  50 +<%= yield :bottom %>
53 51
54 </body> 52 </body>
55 </html> 53 </html>
app/views/static/home.haml
  1 += include_videojs_assets
  2 +
1 .breadcrumb 3 .breadcrumb
2 %h1 Menu 4 %h1 Menu
3 5
4 .hero-unit 6 .hero-unit
5 .row-fluid 7 .row-fluid
6 .span4 8 .span4
7 - = html5_video_tag(['/system/videos/vlibras.webm', '/system/videos/vlibras.mp4'], 'video-vlibras', 'video-instructions',  
8 - :autoplay => 'autoplay', :loop => 'loop') 9 + = html5_video_tag(['/system/videos/vlibras.webm', '/system/videos/vlibras.mp4'],
  10 + 'vlibras-video', 'video-instructions', '{ "autoplay": true, "loop": true }')
9 11
10 %br/ 12 %br/
11 %h2= link_to "V-LIBRAS", new_v_libras_request_path 13 %h2= link_to "V-LIBRAS", new_v_libras_request_path
app/views/v_libras/requests/_position_step.haml
1 #position-step.wrapper 1 #position-step.wrapper
2 .video_wrapper 2 .video_wrapper
3 3
4 - = html5_video_tag(['/system/videos/workflow/localizacao.webm', '/system/videos/workflow/localizacao.mp4'], 'id-4', 'video-wizard') 4 + = html5_video_tag(['/system/videos/workflow/localizacao.webm', '/system/videos/workflow/localizacao.mp4'],
  5 + 'id-4', 'video-wizard', '{ "preload": true, "controls": false }')
5 6
6 - content_for :javascript_code do 7 - content_for :javascript_code do
7 :javascript 8 :javascript
@@ -21,6 +22,4 @@ @@ -21,6 +22,4 @@
21 22
22 var VLibrasPosition = new VLibrasLocalization(); 23 var VLibrasPosition = new VLibrasLocalization();
23 VLibrasPosition.init("#position-step", optionsPosition); 24 VLibrasPosition.init("#position-step", optionsPosition);
24 -  
25 - videojs("id-4", { "controls": false, "autoplay": false, "preload": "true", "width": 940, "height": 530 });  
26 }); 25 });
27 \ No newline at end of file 26 \ No newline at end of file
app/views/v_libras/requests/_service_step.haml
1 #service-step.wrapper 1 #service-step.wrapper
2 .video_wrapper 2 .video_wrapper
3 3
4 - = html5_video_tag(['/system/videos/workflow/sub_audio.webm', '/system/videos/workflow/sub_audio.mp4'], 'id-2', 'video-wizard') 4 + = html5_video_tag(['/system/videos/workflow/sub_audio.webm', '/system/videos/workflow/sub_audio.mp4'],
  5 + 'id-2', 'video-wizard', '{ "preload": true, "controls": false }')
5 6
6 .row-fluid.hide 7 .row-fluid.hide
7 .span1.offset3 8 .span1.offset3
@@ -25,7 +26,5 @@ @@ -25,7 +26,5 @@
25 26
26 var VLibrasSubAudio = new VLibrasLocalization(); 27 var VLibrasSubAudio = new VLibrasLocalization();
27 VLibrasSubAudio.init("#service-step", optionsService); 28 VLibrasSubAudio.init("#service-step", optionsService);
28 -  
29 - videojs("id-2", { "controls": false, "autoplay": false, "preload": "true", "width": 940, "height": 530 });  
30 }); 29 });
31 30
app/views/v_libras/requests/_size_step.haml
1 #size-step.wrapper 1 #size-step.wrapper
2 .video_wrapper 2 .video_wrapper
3 3
4 - = html5_video_tag(['/system/videos/workflow/tamanho.webm', '/system/videos/workflow/tamanho.mp4'], 'id-3', 'video-wizard') 4 + = html5_video_tag(['/system/videos/workflow/tamanho.webm', '/system/videos/workflow/tamanho.mp4'],
  5 + 'id-3', 'video-wizard', '{ "preload": true, "controls": false }')
5 6
6 7
7 - content_for :javascript_code do 8 - content_for :javascript_code do
@@ -20,7 +21,5 @@ @@ -20,7 +21,5 @@
20 21
21 var VLibrasSize = new VLibrasLocalization(); 22 var VLibrasSize = new VLibrasLocalization();
22 VLibrasSize.init("#size-step", optionsSize); 23 VLibrasSize.init("#size-step", optionsSize);
23 -  
24 - videojs("id-3", { "controls": false, "autoplay": false, "preload": "true", "width": 940, "height": 530 });  
25 }); 24 });
26 25
app/views/v_libras/requests/_video_step.haml
1 #video-step.wrapper 1 #video-step.wrapper
2 - = 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'],
  3 + 'id-1', 'video-wizard', '{ "autoplay": true, "controls": false }')
3 4
4 .row-fluid 5 .row-fluid
5 .span1.offset3 6 .span1.offset3
@@ -19,6 +20,4 @@ @@ -19,6 +20,4 @@
19 20
20 var VLibrasVideo = new VLibrasLocalization(); 21 var VLibrasVideo = new VLibrasLocalization();
21 VLibrasVideo.init("#video-step", optionsVideo); 22 VLibrasVideo.init("#video-step", optionsVideo);
22 -  
23 - videojs("id-1", { "controls": false, "autoplay": true, "preload": "true", "width": 940, "height": 530 });  
24 }) 23 })
25 \ No newline at end of file 24 \ No newline at end of file
app/views/v_libras/requests/new.haml
  1 += include_videojs_assets
  2 +
1 - content_for :js do 3 - content_for :js do
2 = javascript_include_tag "jquery.steps.js" 4 = javascript_include_tag "jquery.steps.js"
3 = javascript_include_tag "v_libras/requests/shared" 5 = javascript_include_tag "v_libras/requests/shared"
app/views/v_libras/videos/index.haml
  1 += include_videojs_assets
  2 +
1 - content_for :js do 3 - content_for :js do
2 = javascript_include_tag "v_libras/videos/index" 4 = javascript_include_tag "v_libras/videos/index"
3 5
@@ -51,14 +53,14 @@ @@ -51,14 +53,14 @@
51 %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", type: "button"} × 53 %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", type: "button"} ×
52 %h3 Aguarde... 54 %h3 Aguarde...
53 .modal-body 55 .modal-body
54 - = html5_video_tag(['/system/videos/aguarde.webm', '/system/videos/aguarde.mp4'], 'video-wait', 'video-instructions auto-margin') 56 + = html5_video_tag(['/system/videos/aguarde.webm', '/system/videos/aguarde.mp4'], 'video-wait', 'video-instructions auto-margin',
  57 + '{ "preload": true, "controls": false, "autoplay": true }')
  58 +
55 .modal-footer 59 .modal-footer
56 %a.btn{"aria-hidden" => "true", "data-dismiss" => "modal", href: "#"} Fechar 60 %a.btn{"aria-hidden" => "true", "data-dismiss" => "modal", href: "#"} Fechar
57 61
58 - content_for :javascript_code do 62 - content_for :javascript_code do
59 :javascript 63 :javascript
60 $(function () { 64 $(function () {
61 - videojs("video-wait", { "controls": false, "autoplay": true, "preload": "true", "width": "400px", "height": "300px" });  
62 -  
63 $('#modal-wait').modal(); 65 $('#modal-wait').modal();
64 }) 66 })
65 \ No newline at end of file 67 \ No newline at end of file
app/views/v_libras/videos/show.haml
  1 += include_videojs_assets
  2 +
1 .breadcrumb 3 .breadcrumb
2 %h3= "Vídeo #{@video.request.video_filename}" 4 %h3= "Vídeo #{@video.request.video_filename}"
3 5
4 .row-fluid 6 .row-fluid
5 - .span12.text-center.well  
6 - = html5_video_tag(@video.url_mp4, 'video-vlibras', 'video-vlibras', :autoplay => 'autoplay', :controls => 'controls')  
7 \ No newline at end of file 7 \ No newline at end of file
  8 + .span12.well
  9 + .video-vlibras.text-center
  10 + = html5_video_tag(@video.url_mp4,
  11 + 'video-vlibras', '', '{ "controls": true, "autoplay": false }')
8 \ No newline at end of file 12 \ No newline at end of file