OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html i18n-values="dir:textdirection;"> | 2 <html i18n-values="dir:textdirection;"> |
3 <head> | 3 <head> |
4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
5 <title>Media Player</title> | 5 <title>Media Player</title> |
6 <style type="text/css"> | 6 <style type="text/css"> |
7 | 7 |
8 body { | 8 body { |
9 overflow: hidden; | 9 overflow: hidden; |
10 background: black; | 10 background: black; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 width: 28px; | 252 width: 28px; |
253 height: 30px; | 253 height: 30px; |
254 background: url('../../app/theme/mediaplayer_playlist.png'); | 254 background: url('../../app/theme/mediaplayer_playlist.png'); |
255 background-repeat: no-repeat; | 255 background-repeat: no-repeat; |
256 background-position: 6px 8px; | 256 background-position: 6px 8px; |
257 border-left: 1px solid #424242; | 257 border-left: 1px solid #424242; |
258 border-right: 1px solid black; | 258 border-right: 1px solid black; |
259 } | 259 } |
260 | 260 |
261 </style> | 261 </style> |
262 <script src='local_strings.js'></script> | 262 <script src="shared/js/local_strings.js"></script> |
263 <script> | 263 <script> |
264 | 264 |
265 function $(o) { | 265 function $(o) { |
266 return document.getElementById(o); | 266 return document.getElementById(o); |
267 } | 267 } |
268 | 268 |
269 function pathIsVideoFile(path) { | 269 function pathIsVideoFile(path) { |
270 return /\.(mp4|ogg|mpg|avi)$/i.test(path); | 270 return /\.(mp4|ogg|mpg|avi)$/i.test(path); |
271 }; | 271 }; |
272 | 272 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 function onMediaComplete() { | 320 function onMediaComplete() { |
321 var mediaElement = getMediaElement(); | 321 var mediaElement = getMediaElement(); |
322 mediaElement.removeEventListener("progress", onLoadedProgress, true); | 322 mediaElement.removeEventListener("progress", onLoadedProgress, true); |
323 mediaElement.removeEventListener("timeupdate", onMediaProgress, true); | 323 mediaElement.removeEventListener("timeupdate", onMediaProgress, true); |
324 mediaElement.removeEventListener("durationchange", onMetadataAvail, true); | 324 mediaElement.removeEventListener("durationchange", onMetadataAvail, true); |
325 // MediaElement.removeEventListener("ended", onMediaComplete, true); | 325 // MediaElement.removeEventListener("ended", onMediaComplete, true); |
326 mediaElement.removeEventListener("play", onMediaPlay, true); | 326 mediaElement.removeEventListener("play", onMediaPlay, true); |
327 mediaElement.removeEventListener("pause", onMediaPause, true); | 327 mediaElement.removeEventListener("pause", onMediaPause, true); |
328 currentItem ++; | 328 currentItem ++; |
329 | 329 |
330 if (currentItem >= currentPlaylist.length) { | 330 if (currentItem >= currentPlaylist.length) { |
331 currentItem = -1; | 331 currentItem = -1; |
332 return; | 332 return; |
333 } | 333 } |
334 chrome.send('currentOffsetChanged', ['' + currentItem]); | 334 chrome.send('currentOffsetChanged', ['' + currentItem]); |
335 playMediaFile(currentPlaylist[currentItem].path); | 335 playMediaFile(currentPlaylist[currentItem].path); |
336 }; | 336 }; |
337 | 337 |
338 function onMediaPlay() { | 338 function onMediaPlay() { |
339 var pausebutton = $('pausebutton'); | 339 var pausebutton = $('pausebutton'); |
340 var playbutton = $('playbutton'); | 340 var playbutton = $('playbutton'); |
341 pausebutton.style.display = 'block'; | 341 pausebutton.style.display = 'block'; |
342 playbutton.style.display = 'none'; | 342 playbutton.style.display = 'none'; |
343 }; | 343 }; |
344 | 344 |
345 function onMediaPause() { | 345 function onMediaPause() { |
346 var pausebutton = $('pausebutton'); | 346 var pausebutton = $('pausebutton'); |
347 var playbutton = $('playbutton'); | 347 var playbutton = $('playbutton'); |
348 playbutton.style.display = 'block'; | 348 playbutton.style.display = 'block'; |
349 pausebutton.style.display = 'none'; | 349 pausebutton.style.display = 'none'; |
350 }; | 350 }; |
351 | 351 |
352 function setupMediaEvents(element) { | 352 function setupMediaEvents(element) { |
353 element.addEventListener("progress", onLoadedProgress, true); | 353 element.addEventListener("progress", onLoadedProgress, true); |
354 element.addEventListener("timeupdate", onMediaProgress, true); | 354 element.addEventListener("timeupdate", onMediaProgress, true); |
355 element.addEventListener("durationchange", onMetadataAvail, true); | 355 element.addEventListener("durationchange", onMetadataAvail, true); |
356 // element.addEventListener("ended", onMediaComplete, true); | 356 // element.addEventListener("ended", onMediaComplete, true); |
357 element.onerror = onMediaError; | 357 element.onerror = onMediaError; |
358 element.addEventListener("play", onMediaPlay, true); | 358 element.addEventListener("play", onMediaPlay, true); |
359 element.addEventListener("pause", onMediaPause, true); | 359 element.addEventListener("pause", onMediaPause, true); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 } else if (audioPlaybackElement != null) { | 437 } else if (audioPlaybackElement != null) { |
438 controlsclass = 'audio'; | 438 controlsclass = 'audio'; |
439 element.className = 'audiocontrols'; | 439 element.className = 'audiocontrols'; |
440 } | 440 } |
441 | 441 |
442 var playbutton = document.createElement('div'); | 442 var playbutton = document.createElement('div'); |
443 playbutton.id = 'playbutton'; | 443 playbutton.id = 'playbutton'; |
444 playbutton.className = controlsclass + ' playbutton'; | 444 playbutton.className = controlsclass + ' playbutton'; |
445 playbutton.onclick = playPauseButtonClick; | 445 playbutton.onclick = playPauseButtonClick; |
446 element.appendChild(playbutton); | 446 element.appendChild(playbutton); |
447 | 447 |
448 | 448 |
449 var pausebutton = document.createElement('div'); | 449 var pausebutton = document.createElement('div'); |
450 pausebutton.id = 'pausebutton'; | 450 pausebutton.id = 'pausebutton'; |
451 pausebutton.className = controlsclass + ' pausebutton'; | 451 pausebutton.className = controlsclass + ' pausebutton'; |
452 pausebutton.onclick = playPauseButtonClick; | 452 pausebutton.onclick = playPauseButtonClick; |
453 element.appendChild(pausebutton); | 453 element.appendChild(pausebutton); |
454 | 454 |
455 var nextbutton = document.createElement('div'); | 455 var nextbutton = document.createElement('div'); |
456 nextbutton.id = 'nextbutton'; | 456 nextbutton.id = 'nextbutton'; |
457 nextbutton.className = controlsclass + ' nextbutton'; | 457 nextbutton.className = controlsclass + ' nextbutton'; |
(...skipping 15 matching lines...) Expand all Loading... |
473 var slider = document.createElement('input'); | 473 var slider = document.createElement('input'); |
474 slider.type = 'range'; | 474 slider.type = 'range'; |
475 slider.id = 'progress'; | 475 slider.id = 'progress'; |
476 slider.className = controlsclass + ' progress'; | 476 slider.className = controlsclass + ' progress'; |
477 slider.onchange = userChangedProgress; | 477 slider.onchange = userChangedProgress; |
478 element.appendChild(slider); | 478 element.appendChild(slider); |
479 | 479 |
480 var sliderback = document.createElement('div'); | 480 var sliderback = document.createElement('div'); |
481 sliderback.className = 'sliderback'; | 481 sliderback.className = 'sliderback'; |
482 element.appendChild(sliderback); | 482 element.appendChild(sliderback); |
483 | 483 |
484 var loaded = document.createElement('div'); | 484 var loaded = document.createElement('div'); |
485 loaded.id = 'sliderloaded'; | 485 loaded.id = 'sliderloaded'; |
486 loaded.className = 'sliderloaded'; | 486 loaded.className = 'sliderloaded'; |
487 sliderback.appendChild(loaded); | 487 sliderback.appendChild(loaded); |
488 | 488 |
489 var played = document.createElement('div'); | 489 var played = document.createElement('div'); |
490 played.id = 'sliderplayed'; | 490 played.id = 'sliderplayed'; |
491 played.className = 'sliderplayed'; | 491 played.className = 'sliderplayed'; |
492 sliderback.appendChild(played); | 492 sliderback.appendChild(played); |
493 | 493 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 } | 646 } |
647 }; | 647 }; |
648 | 648 |
649 </script> | 649 </script> |
650 <body onload='load();' onselectstart='return false'> | 650 <body onload='load();' onselectstart='return false'> |
651 <div id='glow' class='glow'></div> | 651 <div id='glow' class='glow'></div> |
652 <div id='playercontrols' class='playercontrols'> | 652 <div id='playercontrols' class='playercontrols'> |
653 </div> | 653 </div> |
654 </body> | 654 </body> |
655 </html> | 655 </html> |
OLD | NEW |