OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * @param {Element} playerContainer Main container. | 8 * @param {Element} playerContainer Main container. |
9 * @param {Element} videoContainer Container for the video element. | 9 * @param {Element} videoContainer Container for the video element. |
10 * @param {Element} controlsContainer Container for video controls. | 10 * @param {Element} controlsContainer Container for video controls. |
(...skipping 29 matching lines...) Expand all Loading... |
40 player.advance_(1); | 40 player.advance_(1); |
41 break; | 41 break; |
42 case 'Left': | 42 case 'Left': |
43 case 'MediaPreviousTrack': | 43 case 'MediaPreviousTrack': |
44 player.advance_(0); | 44 player.advance_(0); |
45 break; | 45 break; |
46 case 'MediaStop': | 46 case 'MediaStop': |
47 // TODO: Define "Stop" behavior. | 47 // TODO: Define "Stop" behavior. |
48 break; | 48 break; |
49 } | 49 } |
50 e.preventDefault(); | |
51 }.wrap(this)); | 50 }.wrap(this)); |
52 | 51 |
53 // TODO(mtomasz): Simplify. crbug.com/254318. | 52 // TODO(mtomasz): Simplify. crbug.com/254318. |
54 var clickInProgress = false; | 53 var clickInProgress = false; |
55 videoContainer.addEventListener('click', function(e) { | 54 videoContainer.addEventListener('click', function(e) { |
56 if (clickInProgress) | 55 if (clickInProgress) |
57 return; | 56 return; |
58 | 57 |
59 clickInProgress = true; | 58 clickInProgress = true; |
60 var togglePlayState = function() { | 59 var togglePlayState = function() { |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 var initPromise = Promise.all( | 605 var initPromise = Promise.all( |
607 [new Promise(initVideos.wrap(null)), | 606 [new Promise(initVideos.wrap(null)), |
608 new Promise(initStrings.wrap(null)), | 607 new Promise(initStrings.wrap(null)), |
609 new Promise(util.addPageLoadHandler.wrap(null))]); | 608 new Promise(util.addPageLoadHandler.wrap(null))]); |
610 | 609 |
611 initPromise.then(function(results) { | 610 initPromise.then(function(results) { |
612 var videos = results[0]; | 611 var videos = results[0]; |
613 player.prepare(videos); | 612 player.prepare(videos); |
614 return new Promise(player.playFirstVideo.wrap(player)); | 613 return new Promise(player.playFirstVideo.wrap(player)); |
615 }.wrap(null)); | 614 }.wrap(null)); |
OLD | NEW |