Skip to content

Commit 77bd452

Browse files
committed
Official v3.5 Release
1 parent 113a06d commit 77bd452

File tree

4 files changed

+551
-600
lines changed

4 files changed

+551
-600
lines changed

videoplayer/config/videoplayer/jci/gui/apps/_videoplayer/js/videoplayer-v3.js

Lines changed: 35 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
var currentVideoListContainer = 0;
100100
var totalVideoListContainer = 0;
101101
var waitingWS = false;
102-
var waitingForClose = false;
102+
var waitingForClose = true;
103103
var totalVideos = 0;
104104
var intervalVideoPlayer = null;
105105
var VideoPaused = false;
@@ -162,6 +162,7 @@
162162
player = framework.getAppInstance('_videoplayer');
163163
currentVideoTrack = player.currentVideoTrack || currentVideoTrack;
164164
ResumePlay = player.resumeVideo || ResumePlay;
165+
waitingForClose = true;
165166
try {
166167
$('#SbSpeedo, #Sbfuel-bar-wrapper').fadeOut();
167168
if (localStorage.getItem('videoplayer.colortheme')) {
@@ -221,7 +222,7 @@
221222

222223
src += 'rm -f /tmp/root/.gstreamer-0.10/registry.arm.bin; '; //cleans the gstreamer registry
223224

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
225226

226227
myVideoWs(src, false); //start-swap
227228

@@ -262,7 +263,7 @@
262263
/* stop playback
263264
==================================================================================*/
264265
$('#myVideoStopBtn, #videoStopBtn').click(function() {
265-
player.resumePlay = 0;
266+
player.resumePlay = null;
266267
currentVideoTrack = null;
267268
CurrentVideoPlayTime = null;
268269
myVideoStopRequest();
@@ -370,7 +371,7 @@
370371
localStorage.setItem('videoplayer.statusbartitle', JSON.stringify(statusbarTitleVideo));
371372
$('#blackOutVideoStatus').removeClass('out');
372373
if (currentVideoTrack !== null && BlackOut) {
373-
(statusbarTitleVideo) ? $('.VPCtrlAppName, #blackOutVideoStatus').fadeIn(): $('.VPCtrlAppName, #blackOutVideoStatus').fadeOut();
374+
(statusbarTitleVideo) ? $('.VPCtrlAppName, #blackOutVideoStatus').removeClass('out'): $('.VPCtrlAppName, #blackOutVideoStatus').addClass('out');
374375
}
375376
});
376377

@@ -394,17 +395,6 @@
394395
localStorage.setItem('videoplayer.resumevideo', JSON.stringify(ResumePlay));
395396
});
396397

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-
408398
/* Video information / options panel
409399
==================================================================================*/
410400
$('#myVideoInfo, #myVideoInfoClose').click(function() {
@@ -470,11 +460,11 @@
470460
if (framework.getCurrentApp() !== '_videoplayer') {
471461
CloseVideoFrame();
472462
}
473-
}, 100); //some performance issues ??
463+
}, 10); //some performance issues ??
474464
// unmount swap on boot
475465
setTimeout(function() {
476466
myVideoWs('[ -e /tmp/mnt/sd*/swapfile ] && echo VP_SWAP || echo VP_NOSWAP', true);
477-
}, 10000);
467+
}, 1000);
478468
}
479469

480470
// try not to make changes to the lines below
@@ -498,11 +488,8 @@
498488
currentVideoListContainer = 0;
499489
$('#myVideoScrollUp, #myVideoScrollDown').css({ 'visibility': '' });
500490
$('#myVideoList').html("<img id='ajaxLoader' src='apps/_videoplayer/templates/VideoPlayer/images/ajax-loader.gif'>");
501-
502491
src = '';
503-
504492
src += 'FILES=""; ';
505-
506493
if (!PlayMusic) {
507494
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;';
508495
$('#myVideoFullScrBtn').css({ 'visibility': '' });
@@ -512,14 +499,11 @@
512499
$('#myVideoFullScrBtn').css({ 'visibility': 'hidden' });
513500
$("#myVideoFullScrBtn").removeClass('playbackOption');
514501
}
515-
516502
src += 'do ' +
517503
'FILES="${FILES}${VIDEO}|"; ' +
518504
'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}"';
523507
myVideoWs(src, true); //playback-list
524508
}
525509

@@ -657,7 +641,7 @@
657641
optionsPanelOpen = false;
658642
player.musicIsPaused = true;
659643
currentVideoTrack = $(".videoTrack").index(obj);
660-
CurrentVideoPlayTime = player.resumePlay;
644+
CurrentVideoPlayTime = player.resumePlay || 0;
661645
var videoToPlay = obj.attr('video-data');
662646
$('#myVideoName').html('Preparing to play...');
663647
$('#myVideoStatus, #blackOutVideoStatus, #myMusicMetadata').html('');
@@ -705,13 +689,10 @@
705689
$('#videoPlayBtn').css({ 'background-image': '' });
706690
$('.VPControlOverlay').removeClass('wideVideo');
707691

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()));
715696
if (statusbarTitleVideo) {
716697
framework.common.setSbName(videoTitleFilter($('#myVideoName').text()));
717698
}
@@ -746,11 +727,11 @@
746727
wsVideo.send('/usr/bin/gst-discoverer-0.10 -v "' + videoToPlay + '"');
747728
//}
748729
wsVideo.send(src);
749-
if (CurrentVideoPlayTime) {
730+
if (CurrentVideoPlayTime > 1) {
750731
setTimeout(function() {
751732
wsVideo.send('e 0 t' + (CurrentVideoPlayTime - 1));
752733
wsVideo.send('h');
753-
}, 300);
734+
}, 600);
754735
}
755736

756737
};
@@ -815,15 +796,11 @@
815796
myVideoWs('killall -9 gplay', false);
816797
wsVideo.close();
817798
wsVideo = null;
818-
} catch (e) {
819-
820-
}
821-
799+
} catch (e) { }
822800
myVideoStartRequest(nextVideoObject);
823801
} else {
824802
myVideoStopRequest();
825803
}
826-
827804
waitingWS = false;
828805
}
829806
}
@@ -1026,11 +1003,11 @@
10261003
if (black) {
10271004
$('.VPControlOverlay').addClass('blackOut');
10281005
if (statusbarTitleVideo) {
1029-
$('.VPCtrlAppName, #blackOutVideoStatus').fadeIn(1000);
1006+
$('.VPCtrlAppName, #blackOutVideoStatus').removeClass('out');
10301007
}
10311008
} else {
10321009
$('.VPControlOverlay').removeClass('blackOut');
1033-
$('.VPCtrlAppName, #blackOutVideoStatus').fadeOut(1000);
1010+
$('.VPCtrlAppName, #blackOutVideoStatus').addClass('out');
10341011
}
10351012
}
10361013

@@ -1046,18 +1023,18 @@
10461023
$('.memErrorMessage').remove();
10471024
clearInterval(retryCountdown);
10481025
retryCountdown = null;
1049-
CurrentVideoPlayTime = player.resumePlay;
1026+
CurrentVideoPlayTime = player.resumePlay || 0;
10501027
if (!PlayMusic) {
10511028
if (FullScreen !== 2) {
10521029
fullScreenRequest();
10531030
}
10541031
toggleBlackOut(BlackOut);
10551032
}
1056-
if (CurrentVideoPlayTime > 0) {
1033+
if (CurrentVideoPlayTime > 1) {
10571034
setTimeout(function() {
1058-
wsVideo.send('e 0 t' + CurrentVideoPlayTime);
1035+
wsVideo.send('e 0 t' + CurrentVideoPlayTime - 1);
10591036
wsVideo.send('h');
1060-
}, 200);
1037+
}, 500);
10611038
}
10621039
player.resumePlay = null;
10631040
retryAttempts = 0;
@@ -1150,25 +1127,15 @@
11501127
if ((currentVideoTrack === null) || (currentVideoTrack > totalVideos - 1)) {
11511128
currentVideoTrack = player.currentVideoTrack || 0;
11521129
}
1153-
11541130
selectedItem = currentVideoTrack;
1155-
11561131
currentVideoTrack = null;
1157-
11581132
if (player.resumePlay && framework.getCurrentApp() === "_videoplayer") {
1159-
11601133
myVideoStartRequest($(".videoTrack").eq(selectedItem));
1161-
11621134
} else {
1163-
11641135
$(".videoListContainer:eq(" + currentVideoListContainer + ")").css("display", "none");
1165-
11661136
currentVideoListContainer = ((selectedItem) / 8) >> 0;
1167-
11681137
$(".videoListContainer:eq(" + currentVideoListContainer + ")").css("display", "");
1169-
11701138
$(".videoTrack").eq(selectedItem).addClass(vpColorClass);
1171-
11721139
myVideoListScrollUpDown('other'); // moved from 4 lines above
11731140
}
11741141
}
@@ -1229,8 +1196,8 @@
12291196
/* Stop and close the video frame
12301197
============================================================================================= */
12311198
function CloseVideoFrame() {
1232-
if (!waitingForClose) {
1233-
waitingForClose = true;
1199+
if (waitingForClose) {
1200+
waitingForClose = false;
12341201
myVideoStopRequest();
12351202
clearInterval(intervalVideoPlayer);
12361203
clearInterval(intervalPlaytime);
@@ -1268,16 +1235,12 @@
12681235
} else if (currentVideoTrack === null) {
12691236
if ((currentVideoListContainer + 1) < totalVideoListContainer) {
12701237
$('#myVideoScrollDown').click();
1271-
12721238
$(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
12731239
$(".videoTrack").removeClass(vpColorClass);
1274-
12751240
selectedItem += 8;
1276-
12771241
if (selectedItem >= totalVideos) {
12781242
selectedItem = totalVideos - 1;
12791243
}
1280-
12811244
$(".videoTrack").eq(selectedItem).addClass(vpColorClass);
12821245
} else if ((currentVideoListContainer + 1) === totalVideoListContainer) {
12831246
$(".videoTrack").removeClass(vpColorClass);
@@ -1296,7 +1259,6 @@
12961259
} else if (currentVideoTrack === null) {
12971260
if (currentVideoListContainer > 0) {
12981261
$('#myVideoScrollUp').click();
1299-
13001262
$(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
13011263
$(".videoTrack").removeClass(vpColorClass);
13021264
selectedItem -= 8;
@@ -1321,20 +1283,14 @@
13211283
$('#myVideoRW').click();
13221284
} else {
13231285
$(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
1324-
13251286
if (selectedItem > 0) {
13261287
$(".videoTrack").removeClass(vpColorClass);
1327-
13281288
if ((selectedItem % 8) === 0) {
13291289
$('#myVideoScrollUp').click();
13301290
}
1331-
13321291
selectedItem--;
1333-
13341292
$(".videoTrack").eq(selectedItem).addClass(vpColorClass);
1335-
1336-
} else //if (selectedItem < 0)
1337-
{
1293+
} else { //if (selectedItem < 0)
13381294
$(".videoTrack").removeClass(vpColorClass);
13391295
selectedItem = totalVideos - 1;
13401296
myVideoListScrollUpDown('bottom');
@@ -1353,17 +1309,14 @@
13531309
$('#myVideoFF').click();
13541310
} else {
13551311
$(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
1356-
13571312
if (selectedItem < totalVideos - 1) {
13581313
$(".videoTrack").removeClass(vpColorClass);
13591314
selectedItem++;
13601315
$(".videoTrack").eq(selectedItem).addClass(vpColorClass);
1361-
13621316
if ((selectedItem > 0) && ((selectedItem % 8) === 0)) {
13631317
$('#myVideoScrollDown').click();
13641318
}
1365-
} else //if (selectedItem >= totalVideos)
1366-
{
1319+
} else { //if (selectedItem >= totalVideos)
13671320
$(".videoTrack").removeClass(vpColorClass);
13681321
selectedItem = 0;
13691322
myVideoListScrollUpDown('top');
@@ -1379,15 +1332,11 @@
13791332
$('#popInfoTab').click();
13801333
} else {
13811334
$(".videoTrack").removeClass(vpColorClass);
1382-
13831335
$(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
1384-
13851336
selectedOptionItem++;
1386-
13871337
if (selectedOptionItem >= $(".playbackOption").length) {
13881338
selectedOptionItem = 0;
13891339
}
1390-
13911340
$(".playbackOption").eq(selectedOptionItem).css("background-image", function(i, val) { return val + ", -o-linear-gradient(top," + vphColor + ", rgba(0,0,0,0))"; });
13921341
}
13931342
break;
@@ -1415,15 +1364,11 @@
14151364
$('#popOptionsTab').click();
14161365
} else {
14171366
$(".videoTrack").removeClass(vpColorClass);
1418-
14191367
$(".playbackOption").css("background-image", function(i, val) { return val.substring(0, val.indexOf(")") + 1); });
1420-
14211368
selectedOptionItem--;
1422-
14231369
if (selectedOptionItem < 0) {
14241370
selectedOptionItem = $(".playbackOption").length - 1;
14251371
}
1426-
14271372
$(".playbackOption").eq(selectedOptionItem).css("background-image", function(i, val) { return val + ", -o-linear-gradient(top," + vphColor + ", rgba(0,0,0,0))"; });
14281373
}
14291374
break;
@@ -1468,11 +1413,13 @@
14681413
// Not Playing: SelectCurrentTrack
14691414
SelectCurrentTrack();
14701415
break;
1471-
case 'up': // Open/Close Info/Options panel
1416+
case 'up': // Open/Close Options panel
14721417
$('#myVideoInfo').click();
1418+
$('#popInfoTab').click();
14731419
break;
1474-
case 'down': // Open/Close Info/Options panel
1420+
case 'down': // Open/Close Info panel
14751421
$('#myVideoInfo').click();
1422+
$('#popOptionsTab').click();
14761423
break;
14771424
case 'left': // Play previous video
14781425
myVideoPreviousRequest();
@@ -1510,11 +1457,11 @@
15101457
} else if (res.indexOf('VP_SWAP') !== -1) {
15111458
$('#unmountSwapVP').show();
15121459
// start unmount swapfile function
1513-
if (UMswap === null) {
1514-
swapfileShutdownUnmount();
1460+
if (vpWaitingForShutdown === null) {
1461+
videoPlayerShutdown();
15151462
}
15161463
} else if (res.indexOf('VP_NOSWAP') !== -1) {
1517-
$('#unmountSwapVP').hide();
1464+
$('.vpUnmnt').remove();
15181465
}
15191466
};
15201467

@@ -1530,11 +1477,10 @@
15301477
function videoPlayerShutdown() {
15311478
vpWaitingForShutdown = setInterval(function() {
15321479
if (framework.getCurrCtxtId() === 'WaitForEnding' || framework.getCurrCtxtId() === 'PowerDownAnimation') {
1533-
unmountSwap();
15341480
clearInterval(vpWaitingForShutdown);
15351481
vpWaitingForShutdown = null;
1482+
unmountSwap();
15361483
}
1537-
15381484
}, 100);
15391485
}
15401486
// #############################################################################################

0 commit comments

Comments
 (0)