VideoActivity.java
913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.upc.pbe.upcnews;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.widget.MediaController;
import android.widget.VideoView;
public class VideoActivity extends Activity {
VideoView video;
String url;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
url = "http://imanolbarba.myftp.biz/video.mp4";
// url = ((UpcApp) getApplication()).getDesc();
// Creacio del VideoPlayer associat a una URL
video = (VideoView) findViewById(R.id.videoView1);
video.setVideoURI(Uri.parse(url));
video.setMediaController(new MediaController(this));
video.start();
video.requestFocus();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_video, menu);
return true;
}
}