Commit 45f0581b3970f772d78a625352c7e70a7bdc9c42
1 parent
0fec191e
Exists in
master
Ajuste no tamanho da tela do vídeo de referência.
Showing
2 changed files
with
33 additions
and
8 deletions
Show diff stats
view/assets/css/main.css
view/assets/js/wikilibras.js
| ... | ... | @@ -325,35 +325,55 @@ |
| 325 | 325 | $("#render-avatar").fadeIn(300); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | + function _controlVideo(elId, toPlay) { | |
| 329 | + var videoSrc = $(elId).attr("src"); | |
| 330 | + if (typeof videoSrc == "undefined" || | |
| 331 | + (typeof videoSrc != "undefined" && videoSrc === "")) | |
| 332 | + return; | |
| 333 | + if (toPlay) { | |
| 334 | + $(elId).get(0).play(); | |
| 335 | + } else { | |
| 336 | + $(elId).get(0).pause(); | |
| 337 | + } | |
| 338 | + } | |
| 339 | + | |
| 340 | + function _playVideo(elId) { | |
| 341 | + _controlVideo(elId, true); | |
| 342 | + } | |
| 343 | + | |
| 344 | + function _pauseVideo(elId) { | |
| 345 | + _controlVideo(elId, false); | |
| 346 | + } | |
| 347 | + | |
| 328 | 348 | function _showInitialScreen(toShow) { |
| 329 | 349 | if (toShow) { |
| 330 | 350 | $("#initial-screen").fadeIn(300); |
| 331 | - $("#initial-screen video").get(0).play(); | |
| 351 | + _playVideo("#initial-screen video"); | |
| 332 | 352 | } else { |
| 333 | 353 | $("#initial-screen").hide(); |
| 334 | - $("#initial-screen video").get(0).pause(); | |
| 354 | + _pauseVideo("#initial-screen video"); | |
| 335 | 355 | } |
| 336 | 356 | } |
| 337 | 357 | |
| 338 | 358 | function _showConfigurationScreen(toShow) { |
| 339 | 359 | if (toShow) { |
| 340 | 360 | $("#configuration-screen").show(); |
| 341 | - $("#ref-video-container video").get(0).play(); | |
| 361 | + _playVideo("#ref-video-container video"); | |
| 342 | 362 | } else { |
| 343 | 363 | $("#configuration-screen").hide(); |
| 344 | - $("#ref-video-container video").get(0).pause(); | |
| 364 | + _pauseVideo("#ref-video-container video"); | |
| 345 | 365 | } |
| 346 | 366 | } |
| 347 | 367 | |
| 348 | 368 | function _showRenderScreen(toShow) { |
| 349 | 369 | if (toShow) { |
| 350 | 370 | $("#render-screen").fadeIn(300); |
| 351 | - $("#render-ref video").get(0).play(); | |
| 352 | - $("#render-avatar video").get(0).play(); | |
| 371 | + _playVideo("#render-ref video"); | |
| 372 | + _playVideo("#render-avatar video"); | |
| 353 | 373 | } else { |
| 354 | 374 | $("#render-screen").hide(); |
| 355 | - $("#render-ref video").get(0).pause(); | |
| 356 | - $("#render-avatar video").get(0).pause(); | |
| 375 | + _pauseVideo("#render-ref video"); | |
| 376 | + _pauseVideo("#render-avatar video"); | |
| 357 | 377 | } |
| 358 | 378 | } |
| 359 | 379 | ... | ... |