Commit 117e467b9625b67a7d09e6283048267436e029a3

Authored by Imanol-Mikel Barba Sabariego
1 parent 9add07ed

--no commit message

src/com/upc/pbe/upcnews/Directoris.java
@@ -24,6 +24,7 @@ public class Directoris extends Activity implements OnItemClickListener { @@ -24,6 +24,7 @@ public class Directoris extends Activity implements OnItemClickListener {
24 private Descarrega d = new Descarrega(); 24 private Descarrega d = new Descarrega();
25 private String URL, currentFolder; 25 private String URL, currentFolder;
26 private HTMLParser parser; 26 private HTMLParser parser;
  27 + private VideoActivity videoPlayer;
27 28
28 public void onCreate(Bundle savedInstanceState){ 29 public void onCreate(Bundle savedInstanceState){
29 //Creem el layout 30 //Creem el layout
@@ -38,6 +39,7 @@ public class Directoris extends Activity implements OnItemClickListener { @@ -38,6 +39,7 @@ public class Directoris extends Activity implements OnItemClickListener {
38 parser = new HTMLParser(URL); 39 parser = new HTMLParser(URL);
39 //Fem una llista ListView i la omplim amb la informacio trobada 40 //Fem una llista ListView i la omplim amb la informacio trobada
40 ((ListView)findViewById(R.id.listView1)).setOnItemClickListener(this); 41 ((ListView)findViewById(R.id.listView1)).setOnItemClickListener(this);
  42 + videoPlayer = new VideoActivity();
41 this.showResources(); 43 this.showResources();
42 } 44 }
43 45
@@ -88,8 +90,11 @@ public class Directoris extends Activity implements OnItemClickListener { @@ -88,8 +90,11 @@ public class Directoris extends Activity implements OnItemClickListener {
88 * Log.d(TAG,segment[0]); 90 * Log.d(TAG,segment[0]);
89 * startPlayer(segment[0],segment[1]); 91 * startPlayer(segment[0],segment[1]);
90 */ 92 */
91 - String[] test = {"/sdcard/a.ts","LE TEST"};  
92 - startActivity(new Intent(this, VideoActivity.class)); 93 + Bundle params = new Bundle();
  94 + params.putString("url", "/sdcard/a.ts");
  95 + Intent mIntent = new Intent(this, VideoActivity.class);
  96 + mIntent.putExtras(params);
  97 + startActivity(mIntent);
93 98
94 } 99 }
95 catch (ErrorException e){ 100 catch (ErrorException e){
src/com/upc/pbe/upcnews/HLS.java
@@ -2,9 +2,6 @@ package com.upc.pbe.upcnews; @@ -2,9 +2,6 @@ package com.upc.pbe.upcnews;
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 4
5 -import android.content.ComponentName;  
6 -import android.content.Intent;  
7 -import android.net.Uri;  
8 import android.util.Log; 5 import android.util.Log;
9 6
10 //Gestor del protocol HTTP Live Streaming 7 //Gestor del protocol HTTP Live Streaming
src/com/upc/pbe/upcnews/VideoActivity.java
@@ -10,20 +10,20 @@ import android.widget.VideoView; @@ -10,20 +10,20 @@ import android.widget.VideoView;
10 public class VideoActivity extends Activity { 10 public class VideoActivity extends Activity {
11 11
12 VideoView video; 12 VideoView video;
13 - String url; 13 + String url;
14 14
15 15
16 @Override 16 @Override
17 public void onCreate(Bundle savedInstanceState) { 17 public void onCreate(Bundle savedInstanceState) {
18 super.onCreate(savedInstanceState); 18 super.onCreate(savedInstanceState);
19 setContentView(R.layout.activity_video); 19 setContentView(R.layout.activity_video);
20 - url = "/sdcard/a.ts";  
21 - // url = ((UpcApp) getApplication()).getDesc();  
22 -  
23 -  
24 -  
25 - // Creacio del VideoPlayer associat a una URL  
26 video = (VideoView) findViewById(R.id.videoView1); 20 video = (VideoView) findViewById(R.id.videoView1);
  21 + url = this.getIntent().getExtras().getString("url");
  22 + play();
  23 + }
  24 +
  25 + public void play()
  26 + {
27 video.setVideoURI(Uri.parse(url)); 27 video.setVideoURI(Uri.parse(url));
28 video.setMediaController(new MediaController(this)); 28 video.setMediaController(new MediaController(this));
29 video.start(); 29 video.start();