|
99 | 99 | var currentVideoListContainer = 0;
|
100 | 100 | var totalVideoListContainer = 0;
|
101 | 101 | var waitingWS = false;
|
102 |
| - var waitingForClose = false; |
| 102 | + var waitingForClose = true; |
103 | 103 | var totalVideos = 0;
|
104 | 104 | var intervalVideoPlayer = null;
|
105 | 105 | var VideoPaused = false;
|
|
162 | 162 | player = framework.getAppInstance('_videoplayer');
|
163 | 163 | currentVideoTrack = player.currentVideoTrack || currentVideoTrack;
|
164 | 164 | ResumePlay = player.resumeVideo || ResumePlay;
|
| 165 | + waitingForClose = true; |
165 | 166 | try {
|
166 | 167 | $('#SbSpeedo, #Sbfuel-bar-wrapper').fadeOut();
|
167 | 168 | if (localStorage.getItem('videoplayer.colortheme')) {
|
|
221 | 222 |
|
222 | 223 | src += 'rm -f /tmp/root/.gstreamer-0.10/registry.arm.bin; '; //cleans the gstreamer registry
|
223 | 224 |
|
224 |
| - src += 'gst-inspect-0.10 > /dev/null 2>&1; '; // Start gstreamer before starting videos |
| 225 | + src += 'gst-inspect-0.10 > /dev/null 2>&1 '; // Start gstreamer before starting videos |
225 | 226 |
|
226 | 227 | myVideoWs(src, false); //start-swap
|
227 | 228 |
|
|
262 | 263 | /* stop playback
|
263 | 264 | ==================================================================================*/
|
264 | 265 | $('#myVideoStopBtn, #videoStopBtn').click(function() {
|
265 |
| - player.resumePlay = 0; |
| 266 | + player.resumePlay = null; |
266 | 267 | currentVideoTrack = null;
|
267 | 268 | CurrentVideoPlayTime = null;
|
268 | 269 | myVideoStopRequest();
|
|
370 | 371 | localStorage.setItem('videoplayer.statusbartitle', JSON.stringify(statusbarTitleVideo));
|
371 | 372 | $('#blackOutVideoStatus').removeClass('out');
|
372 | 373 | if (currentVideoTrack !== null && BlackOut) {
|
373 |
| - (statusbarTitleVideo) ? $('.VPCtrlAppName, #blackOutVideoStatus').fadeIn(): $('.VPCtrlAppName, #blackOutVideoStatus').fadeOut(); |
| 374 | + (statusbarTitleVideo) ? $('.VPCtrlAppName, #blackOutVideoStatus').removeClass('out'): $('.VPCtrlAppName, #blackOutVideoStatus').addClass('out'); |
374 | 375 | }
|
375 | 376 | });
|
376 | 377 |
|
|
394 | 395 | localStorage.setItem('videoplayer.resumevideo', JSON.stringify(ResumePlay));
|
395 | 396 | });
|
396 | 397 |
|
397 |
| - /* Test the error message - Dont need this anymore |
398 |
| - ==================================================================================*/ |
399 |
| - /*$('#optionTestError').click(function() { |
400 |
| - $('.VPControlOverlay').css('height', '420px'); |
401 |
| - var res = "test"; |
402 |
| - showMemErrorMessage(res); |
403 |
| - $('.memErrorMessage').delay(1500).fadeOut(3000); |
404 |
| - $('.VPControlOverlay').delay(4000).css('height', ''); |
405 |
| - $(this).blur(); |
406 |
| - });*/ |
407 |
| - |
408 | 398 | /* Video information / options panel
|
409 | 399 | ==================================================================================*/
|
410 | 400 | $('#myVideoInfo, #myVideoInfoClose').click(function() {
|
|
470 | 460 | if (framework.getCurrentApp() !== '_videoplayer') {
|
471 | 461 | CloseVideoFrame();
|
472 | 462 | }
|
473 |
| - }, 100); //some performance issues ?? |
| 463 | + }, 10); //some performance issues ?? |
474 | 464 | // unmount swap on boot
|
475 | 465 | setTimeout(function() {
|
476 | 466 | myVideoWs('[ -e /tmp/mnt/sd*/swapfile ] && echo VP_SWAP || echo VP_NOSWAP', true);
|
477 |
| - }, 10000); |
| 467 | + }, 1000); |
478 | 468 | }
|
479 | 469 |
|
480 | 470 | // try not to make changes to the lines below
|
|
498 | 488 | currentVideoListContainer = 0;
|
499 | 489 | $('#myVideoScrollUp, #myVideoScrollDown').css({ 'visibility': '' });
|
500 | 490 | $('#myVideoList').html("<img id='ajaxLoader' src='apps/_videoplayer/templates/VideoPlayer/images/ajax-loader.gif'>");
|
501 |
| - |
502 | 491 | src = '';
|
503 |
| - |
504 | 492 | src += 'FILES=""; ';
|
505 |
| - |
506 | 493 | if (!PlayMusic) {
|
507 | 494 | src += 'for VIDEO in /tmp/mnt/resources/Movies/*.mp4 /tmp/mnt/sd*/Movies/*.mp4 /tmp/mnt/sd*/Movies/*.avi /tmp/mnt/sd*/Movies/*.flv /tmp/mnt/sd*/Movies/*.wmv /tmp/mnt/sd*/Movies/*.3gp /tmp/mnt/sd*/Movies/*.mkv;';
|
508 | 495 | $('#myVideoFullScrBtn').css({ 'visibility': '' });
|
|
512 | 499 | $('#myVideoFullScrBtn').css({ 'visibility': 'hidden' });
|
513 | 500 | $("#myVideoFullScrBtn").removeClass('playbackOption');
|
514 | 501 | }
|
515 |
| - |
516 | 502 | src += 'do ' +
|
517 | 503 | 'FILES="${FILES}${VIDEO}|"; ' +
|
518 | 504 | 'done; ' +
|
519 |
| - 'FILES=$(echo "${FILES}" | tr \'|\' \'\n\' | sort -f -t \/ -k 6 | tr \'\n\' \'|\'); '; |
520 |
| - |
521 |
| - src += 'echo playback-list//#"${FILES}"'; |
522 |
| - |
| 505 | + 'FILES=$(echo "${FILES}" | tr \'|\' \'\n\' | sort -f -t \/ -k 6 | tr \'\n\' \'|\'); ' + |
| 506 | + 'echo playback-list//#"${FILES}"'; |
523 | 507 | myVideoWs(src, true); //playback-list
|
524 | 508 | }
|
525 | 509 |
|
|
657 | 641 | optionsPanelOpen = false;
|
658 | 642 | player.musicIsPaused = true;
|
659 | 643 | currentVideoTrack = $(".videoTrack").index(obj);
|
660 |
| - CurrentVideoPlayTime = player.resumePlay; |
| 644 | + CurrentVideoPlayTime = player.resumePlay || 0; |
661 | 645 | var videoToPlay = obj.attr('video-data');
|
662 | 646 | $('#myVideoName').html('Preparing to play...');
|
663 | 647 | $('#myVideoStatus, #blackOutVideoStatus, #myMusicMetadata').html('');
|
|
705 | 689 | $('#videoPlayBtn').css({ 'background-image': '' });
|
706 | 690 | $('.VPControlOverlay').removeClass('wideVideo');
|
707 | 691 |
|
708 |
| - if (BlackOut) { |
709 |
| - $('.VPCtrlAppName').text(videoTitleFilter($('#myVideoName').text())); |
710 |
| - $('.VPCtrlAppName, #blackOutVideoStatus').delay(2000).fadeIn(2000); |
711 |
| - if (!statusbarTitleVideo) { |
712 |
| - $('.VPCtrlAppName, #blackOutVideoStatus').delay(5000).fadeOut(5000); |
713 |
| - } |
714 |
| - } |
| 692 | + |
| 693 | + (BlackOut && statusbarTitleVideo) ? $('.VPCtrlAppName, #blackOutVideoStatus').removeClass('out'): $('.VPCtrlAppName, #blackOutVideoStatus').addClass('out'); |
| 694 | + |
| 695 | + $('.VPCtrlAppName').text(videoTitleFilter($('#myVideoName').text())); |
715 | 696 | if (statusbarTitleVideo) {
|
716 | 697 | framework.common.setSbName(videoTitleFilter($('#myVideoName').text()));
|
717 | 698 | }
|
|
746 | 727 | wsVideo.send('/usr/bin/gst-discoverer-0.10 -v "' + videoToPlay + '"');
|
747 | 728 | //}
|
748 | 729 | wsVideo.send(src);
|
749 |
| - if (CurrentVideoPlayTime) { |
| 730 | + if (CurrentVideoPlayTime > 1) { |
750 | 731 | setTimeout(function() {
|
751 | 732 | wsVideo.send('e 0 t' + (CurrentVideoPlayTime - 1));
|
752 | 733 | wsVideo.send('h');
|
753 |
| - }, 300); |
| 734 | + }, 600); |
754 | 735 | }
|
755 | 736 |
|
756 | 737 | };
|
|
815 | 796 | myVideoWs('killall -9 gplay', false);
|
816 | 797 | wsVideo.close();
|
817 | 798 | wsVideo = null;
|
818 |
| - } catch (e) { |
819 |
| - |
820 |
| - } |
821 |
| - |
| 799 | + } catch (e) { } |
822 | 800 | myVideoStartRequest(nextVideoObject);
|
823 | 801 | } else {
|
824 | 802 | myVideoStopRequest();
|
825 | 803 | }
|
826 |
| - |
827 | 804 | waitingWS = false;
|
828 | 805 | }
|
829 | 806 | }
|
|
1026 | 1003 | if (black) {
|
1027 | 1004 | $('.VPControlOverlay').addClass('blackOut');
|
1028 | 1005 | if (statusbarTitleVideo) {
|
1029 |
| - $('.VPCtrlAppName, #blackOutVideoStatus').fadeIn(1000); |
| 1006 | + $('.VPCtrlAppName, #blackOutVideoStatus').removeClass('out'); |
1030 | 1007 | }
|
1031 | 1008 | } else {
|
1032 | 1009 | $('.VPControlOverlay').removeClass('blackOut');
|
1033 |
| - $('.VPCtrlAppName, #blackOutVideoStatus').fadeOut(1000); |
| 1010 | + $('.VPCtrlAppName, #blackOutVideoStatus').addClass('out'); |
1034 | 1011 | }
|
1035 | 1012 | }
|
1036 | 1013 |
|
|
1046 | 1023 | $('.memErrorMessage').remove();
|
1047 | 1024 | clearInterval(retryCountdown);
|
1048 | 1025 | retryCountdown = null;
|
1049 |
| - CurrentVideoPlayTime = player.resumePlay; |
| 1026 | + CurrentVideoPlayTime = player.resumePlay || 0; |
1050 | 1027 | if (!PlayMusic) {
|
1051 | 1028 | if (FullScreen !== 2) {
|
1052 | 1029 | fullScreenRequest();
|
1053 | 1030 | }
|
1054 | 1031 | toggleBlackOut(BlackOut);
|
1055 | 1032 | }
|
1056 |
| - if (CurrentVideoPlayTime > 0) { |
| 1033 | + if (CurrentVideoPlayTime > 1) { |
1057 | 1034 | setTimeout(function() {
|
1058 |
| - wsVideo.send('e 0 t' + CurrentVideoPlayTime); |
| 1035 | + wsVideo.send('e 0 t' + CurrentVideoPlayTime - 1); |
1059 | 1036 | wsVideo.send('h');
|
1060 |
| - }, 200); |
| 1037 | + }, 500); |
1061 | 1038 | }
|
1062 | 1039 | player.resumePlay = null;
|
1063 | 1040 | retryAttempts = 0;
|
|
1150 | 1127 | if ((currentVideoTrack === null) || (currentVideoTrack > totalVideos - 1)) {
|
1151 | 1128 | currentVideoTrack = player.currentVideoTrack || 0;
|
1152 | 1129 | }
|
1153 |
| - |
1154 | 1130 | selectedItem = currentVideoTrack;
|
1155 |
| - |
1156 | 1131 | currentVideoTrack = null;
|
1157 |
| - |
1158 | 1132 | if (player.resumePlay && framework.getCurrentApp() === "_videoplayer") {
|
1159 |
| - |
1160 | 1133 | myVideoStartRequest($(".videoTrack").eq(selectedItem));
|
1161 |
| - |
1162 | 1134 | } else {
|
1163 |
| - |
1164 | 1135 | $(".videoListContainer:eq(" + currentVideoListContainer + ")").css("display", "none");
|
1165 |
| - |
1166 | 1136 | currentVideoListContainer = ((selectedItem) / 8) >> 0;
|
1167 |
| - |
1168 | 1137 | $(".videoListContainer:eq(" + currentVideoListContainer + ")").css("display", "");
|
1169 |
| - |
1170 | 1138 | $(".videoTrack").eq(selectedItem).addClass(vpColorClass);
|
1171 |
| - |
1172 | 1139 | myVideoListScrollUpDown('other'); // moved from 4 lines above
|
1173 | 1140 | }
|
1174 | 1141 | }
|
|
1229 | 1196 | /* Stop and close the video frame
|
1230 | 1197 | ============================================================================================= */
|
1231 | 1198 | function CloseVideoFrame() {
|
1232 |
| - if (!waitingForClose) { |
1233 |
| - waitingForClose = true; |
| 1199 | + if (waitingForClose) { |
| 1200 | + waitingForClose = false; |
1234 | 1201 | myVideoStopRequest();
|
1235 | 1202 | clearInterval(intervalVideoPlayer);
|
1236 | 1203 | clearInterval(intervalPlaytime);
|
|
1268 | 1235 | } else if (currentVideoTrack === null) {
|
1269 | 1236 | if ((currentVideoListContainer + 1) < totalVideoListContainer) {
|
1270 | 1237 | $('#myVideoScrollDown').click();
|
1271 |
| - |
1272 | 1238 | $(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
|
1273 | 1239 | $(".videoTrack").removeClass(vpColorClass);
|
1274 |
| - |
1275 | 1240 | selectedItem += 8;
|
1276 |
| - |
1277 | 1241 | if (selectedItem >= totalVideos) {
|
1278 | 1242 | selectedItem = totalVideos - 1;
|
1279 | 1243 | }
|
1280 |
| - |
1281 | 1244 | $(".videoTrack").eq(selectedItem).addClass(vpColorClass);
|
1282 | 1245 | } else if ((currentVideoListContainer + 1) === totalVideoListContainer) {
|
1283 | 1246 | $(".videoTrack").removeClass(vpColorClass);
|
|
1296 | 1259 | } else if (currentVideoTrack === null) {
|
1297 | 1260 | if (currentVideoListContainer > 0) {
|
1298 | 1261 | $('#myVideoScrollUp').click();
|
1299 |
| - |
1300 | 1262 | $(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
|
1301 | 1263 | $(".videoTrack").removeClass(vpColorClass);
|
1302 | 1264 | selectedItem -= 8;
|
|
1321 | 1283 | $('#myVideoRW').click();
|
1322 | 1284 | } else {
|
1323 | 1285 | $(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
|
1324 |
| - |
1325 | 1286 | if (selectedItem > 0) {
|
1326 | 1287 | $(".videoTrack").removeClass(vpColorClass);
|
1327 |
| - |
1328 | 1288 | if ((selectedItem % 8) === 0) {
|
1329 | 1289 | $('#myVideoScrollUp').click();
|
1330 | 1290 | }
|
1331 |
| - |
1332 | 1291 | selectedItem--;
|
1333 |
| - |
1334 | 1292 | $(".videoTrack").eq(selectedItem).addClass(vpColorClass);
|
1335 |
| - |
1336 |
| - } else //if (selectedItem < 0) |
1337 |
| - { |
| 1293 | + } else { //if (selectedItem < 0) |
1338 | 1294 | $(".videoTrack").removeClass(vpColorClass);
|
1339 | 1295 | selectedItem = totalVideos - 1;
|
1340 | 1296 | myVideoListScrollUpDown('bottom');
|
|
1353 | 1309 | $('#myVideoFF').click();
|
1354 | 1310 | } else {
|
1355 | 1311 | $(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
|
1356 |
| - |
1357 | 1312 | if (selectedItem < totalVideos - 1) {
|
1358 | 1313 | $(".videoTrack").removeClass(vpColorClass);
|
1359 | 1314 | selectedItem++;
|
1360 | 1315 | $(".videoTrack").eq(selectedItem).addClass(vpColorClass);
|
1361 |
| - |
1362 | 1316 | if ((selectedItem > 0) && ((selectedItem % 8) === 0)) {
|
1363 | 1317 | $('#myVideoScrollDown').click();
|
1364 | 1318 | }
|
1365 |
| - } else //if (selectedItem >= totalVideos) |
1366 |
| - { |
| 1319 | + } else { //if (selectedItem >= totalVideos) |
1367 | 1320 | $(".videoTrack").removeClass(vpColorClass);
|
1368 | 1321 | selectedItem = 0;
|
1369 | 1322 | myVideoListScrollUpDown('top');
|
|
1379 | 1332 | $('#popInfoTab').click();
|
1380 | 1333 | } else {
|
1381 | 1334 | $(".videoTrack").removeClass(vpColorClass);
|
1382 |
| - |
1383 | 1335 | $(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
|
1384 |
| - |
1385 | 1336 | selectedOptionItem++;
|
1386 |
| - |
1387 | 1337 | if (selectedOptionItem >= $(".playbackOption").length) {
|
1388 | 1338 | selectedOptionItem = 0;
|
1389 | 1339 | }
|
1390 |
| - |
1391 | 1340 | $(".playbackOption").eq(selectedOptionItem).css("background-image", function(i, val) { return val + ", -o-linear-gradient(top," + vphColor + ", rgba(0,0,0,0))"; });
|
1392 | 1341 | }
|
1393 | 1342 | break;
|
|
1415 | 1364 | $('#popOptionsTab').click();
|
1416 | 1365 | } else {
|
1417 | 1366 | $(".videoTrack").removeClass(vpColorClass);
|
1418 |
| - |
1419 | 1367 | $(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
|
1420 |
| - |
1421 | 1368 | selectedOptionItem--;
|
1422 |
| - |
1423 | 1369 | if (selectedOptionItem < 0) {
|
1424 | 1370 | selectedOptionItem = $(".playbackOption").length - 1;
|
1425 | 1371 | }
|
1426 |
| - |
1427 | 1372 | $(".playbackOption").eq(selectedOptionItem).css("background-image", function(i, val) { return val + ", -o-linear-gradient(top," + vphColor + ", rgba(0,0,0,0))"; });
|
1428 | 1373 | }
|
1429 | 1374 | break;
|
|
1468 | 1413 | // Not Playing: SelectCurrentTrack
|
1469 | 1414 | SelectCurrentTrack();
|
1470 | 1415 | break;
|
1471 |
| - case 'up': // Open/Close Info/Options panel |
| 1416 | + case 'up': // Open/Close Options panel |
1472 | 1417 | $('#myVideoInfo').click();
|
| 1418 | + $('#popInfoTab').click(); |
1473 | 1419 | break;
|
1474 |
| - case 'down': // Open/Close Info/Options panel |
| 1420 | + case 'down': // Open/Close Info panel |
1475 | 1421 | $('#myVideoInfo').click();
|
| 1422 | + $('#popOptionsTab').click(); |
1476 | 1423 | break;
|
1477 | 1424 | case 'left': // Play previous video
|
1478 | 1425 | myVideoPreviousRequest();
|
|
1510 | 1457 | } else if (res.indexOf('VP_SWAP') !== -1) {
|
1511 | 1458 | $('#unmountSwapVP').show();
|
1512 | 1459 | // start unmount swapfile function
|
1513 |
| - if (UMswap === null) { |
1514 |
| - swapfileShutdownUnmount(); |
| 1460 | + if (vpWaitingForShutdown === null) { |
| 1461 | + videoPlayerShutdown(); |
1515 | 1462 | }
|
1516 | 1463 | } else if (res.indexOf('VP_NOSWAP') !== -1) {
|
1517 |
| - $('#unmountSwapVP').hide(); |
| 1464 | + $('.vpUnmnt').remove(); |
1518 | 1465 | }
|
1519 | 1466 | };
|
1520 | 1467 |
|
|
1530 | 1477 | function videoPlayerShutdown() {
|
1531 | 1478 | vpWaitingForShutdown = setInterval(function() {
|
1532 | 1479 | if (framework.getCurrCtxtId() === 'WaitForEnding' || framework.getCurrCtxtId() === 'PowerDownAnimation') {
|
1533 |
| - unmountSwap(); |
1534 | 1480 | clearInterval(vpWaitingForShutdown);
|
1535 | 1481 | vpWaitingForShutdown = null;
|
| 1482 | + unmountSwap(); |
1536 | 1483 | }
|
1537 |
| - |
1538 | 1484 | }, 100);
|
1539 | 1485 | }
|
1540 | 1486 | // #############################################################################################
|
|
0 commit comments