Commit 2ff79d6287baef82e2d5c5924b79fc9b0188d4b6

Authored by Imanol-Mikel Barba Sabariego
1 parent 8eda8798

Corregido bug al ir video atras y volver al que se tenia pendiente

src/com/upc/pbe/upcnews/VideoActivity.java
@@ -38,6 +38,7 @@ public class VideoActivity extends Activity { @@ -38,6 +38,7 @@ public class VideoActivity extends Activity {
38 boolean ended; 38 boolean ended;
39 boolean buffering; 39 boolean buffering;
40 DescarregaSegment ds; 40 DescarregaSegment ds;
  41 + boolean videoNotPlayed;
41 42
42 43
43 @Override 44 @Override
@@ -53,6 +54,7 @@ public class VideoActivity extends Activity { @@ -53,6 +54,7 @@ public class VideoActivity extends Activity {
53 } 54 }
54 setContentView(R.layout.activity_video); 55 setContentView(R.layout.activity_video);
55 currentPos = 0; 56 currentPos = 0;
  57 + videoNotPlayed = false;
56 queue = new ArrayList<String>(); 58 queue = new ArrayList<String>();
57 playedQueue = new ArrayList<String>(); 59 playedQueue = new ArrayList<String>();
58 buffering = true; 60 buffering = true;
@@ -143,8 +145,15 @@ public class VideoActivity extends Activity { @@ -143,8 +145,15 @@ public class VideoActivity extends Activity {
143 } 145 }
144 if(currentPos == 0) 146 if(currentPos == 0)
145 { 147 {
146 - playedQueue.add(queue.get(0));  
147 - queue.remove(0); 148 + if(!videoNotPlayed)
  149 + {
  150 + playedQueue.add(queue.get(0));
  151 + queue.remove(0);
  152 + }
  153 + else
  154 + {
  155 + videoNotPlayed = false;
  156 + }
148 if(ended && queue.isEmpty()) 157 if(ended && queue.isEmpty())
149 { 158 {
150 quitPlayer(); 159 quitPlayer();
@@ -166,6 +175,10 @@ public class VideoActivity extends Activity { @@ -166,6 +175,10 @@ public class VideoActivity extends Activity {
166 175
167 public void playPrevious() 176 public void playPrevious()
168 { 177 {
  178 + if(currentPos == 0)
  179 + {
  180 + videoNotPlayed = true;
  181 + }
169 if(playedQueue.isEmpty()) 182 if(playedQueue.isEmpty())
170 { 183 {
171 play(queue.get(0)); 184 play(queue.get(0));
@@ -241,7 +254,7 @@ public class VideoActivity extends Activity { @@ -241,7 +254,7 @@ public class VideoActivity extends Activity {
241 Long downloaded = Long.valueOf(0); 254 Long downloaded = Long.valueOf(0);
242 long startTime = System.currentTimeMillis(); 255 long startTime = System.currentTimeMillis();
243 long segmentBytes = TrafficStats.getTotalRxBytes(); 256 long segmentBytes = TrafficStats.getTotalRxBytes();
244 - String fileName = urls[0].toString().substring(urls[0].toString().lastIndexOf("/")); 257 + String fileName = urls[0].toString().substring(urls[0].toString().lastIndexOf("/")+1);
245 // Iniciem la connexi� i creem els Streams 258 // Iniciem la connexi� i creem els Streams
246 try 259 try
247 { 260 {