Skip to content

Commit

Permalink
loop around on last item - and missed getVideoKey
Browse files Browse the repository at this point in the history
  • Loading branch information
octatone committed Nov 3, 2011
1 parent c0a795e commit 679896d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions js/tv.js
Expand Up @@ -386,18 +386,22 @@ function loadVideo(video) {
selected_video = globals.shuffled.indexOf(selected_video);
}

if(video === 'next' && selected_video < videos_size){
if(video === 'next' && selected_video <= videos_size){
selected_video++;
if(selected_video > videos_size){
selected_video = 0;
}
while(sfwCheck(getVideoKey(selected_video), this_chan) && selected_video < videos_size){
selected_video++;
}
if(sfwCheck(getVideoKey(selected_video), this_chan)){
selected_video = this_video;
}
}else if(video == 'next' && selected_video == videos_size){
selected_video = 0;
}else if(selected_video > 0 && video === 'prev'){
}else if(selected_video >= 0 && video === 'prev'){
selected_video--;
if(selected_video < 0){
selected_video = videos_size;
}
while(sfwCheck(getVideoKey(selected_video), this_chan) && selected_video > 0){
selected_video--;
}
Expand All @@ -407,7 +411,7 @@ function loadVideo(video) {
}else if(video === 'first'){
selected_video = 0;
if(sfwCheck(getVideoKey(selected_video), this_chan)){
while(sfwCheck(selected_video, this_chan) && selected_video < videos_size){
while(sfwCheck(getVideoKey(selected_video), this_chan) && selected_video < videos_size){
selected_video++;
}
}
Expand Down

0 comments on commit 679896d

Please sign in to comment.