I use android.widget.VideoView play online video, Some phones( Common Feature is use Qualcomm CPU) can't play, other can work well.
What is the cause of this ?
Code
package com.example.vv;
import android.app.Activity;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnErrorListener;
import android.media.MediaPlayer.OnPreparedListener;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
/**
* #author jren
* #parameter
* #return
*/
public class MainActivity extends Activity {
private static final String TAG = "LiveVideoPlay";
private VideoView myVideoView;
private MediaController mediaControls;
MediaController mediaController;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myVideoView = (VideoView) findViewById(R.id.videoview);
playVideo();
}
private void playVideo() {
try {
if (mediaController == null) {
mediaController = new MediaController(MainActivity.this);
}
myVideoView.setMediaController(mediaController);
String StrUri = "http://huison.oss-cn-shenzhen.aliyuncs.com/0001/huison001/live.m3u8";
Uri videoUri = Uri.parse(StrUri);
myVideoView.setVideoURI(videoUri);
myVideoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
myVideoView.start();
}
});
myVideoView.setOnErrorListener(new OnErrorListener() {
#Override
public boolean onError(MediaPlayer mp, int what, int extra) {
return false;
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.vv.MainActivity" >
<VideoView
android:id="#+id/videoview"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
the error:
07-14 15:14:25.872: E/MediaPlayer-JNI(25660): QCMediaPlayer mediaplayer NOT present
07-14 15:14:27.872: W/MediaPlayer(25660): info/warning (801, 0)
Related
I am trying to stream mp3 file from the internet. App successfully started but showing unexpected behavior. The playback doesn't play sound, the play button doesn't changes its icon. The playback stops after showing "please wait message" when it is expected to play the file on clicking the play icon.
Here's my code:
MainActivity.java
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageButton;
import android.widget.SeekBar;
import android.widget.TextView;
import java.util.concurrent.TimeUnit;
import dyanamitechetan.vusikview.VusikView;
public class MainActivity extends AppCompatActivity implements MediaPlayer.OnBufferingUpdateListener, MediaPlayer.OnCompletionListener {
ImageButton imageButton;
SeekBar seekBar;
TextView textView;
VusikView musicView;
MediaPlayer mediaPlayer;
int mediaFileLength;
int realTimeLength;
final Handler handler = new Handler();
#SuppressLint("ClickableViewAccessibility")
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
musicView = findViewById(R.id.musicView);
seekBar = findViewById(R.id.seekbar);
seekBar.setMax(99);
seekBar.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if(mediaPlayer.isPlaying()){
SeekBar seekBar = (SeekBar) view;
int playPosition = (mediaFileLength/100)*seekBar.getProgress();
mediaPlayer.seekTo(playPosition);
}
return false;
}
});
imageButton = findViewById(R.id.btn_play_pause);
imageButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
final ProgressDialog mDialog = new ProgressDialog(MainActivity.this);
AsyncTask<String,String,String>mp3Play = new AsyncTask<String, String, String>() {
#Override
protected void onPreExecute(){
mDialog.setMessage("Please wait");
mDialog.show();
}
#Override
protected String doInBackground(String... strings) {
try {
mediaPlayer.setDataSource(strings[0]);
mediaPlayer.prepare();
}
catch (Exception ex){
}
return "";
}
#Override
protected void onPostExecute(String s) {
mediaFileLength = mediaPlayer.getDuration();
realTimeLength = mediaFileLength;
if(!mediaPlayer.isPlaying()){
mediaPlayer.start();
imageButton.setImageResource(R.drawable.ic_pause);
} else {
mediaPlayer.pause();
imageButton.setImageResource(R.drawable.ic_play);
}
updateSeekBar();
mDialog.dismiss();
}
};
mp3Play.execute("https://soundcloud.com/theastonshuffle/nasa-feat-kanye-west-santogold-lykke-li-gifted-aston-shuffle-long-mix");
musicView.start();
}
});
mediaPlayer = new MediaPlayer();
mediaPlayer.setOnBufferingUpdateListener(this);
mediaPlayer.setOnCompletionListener(this);
}
private void updateSeekBar() {
seekBar.setProgress((int)((float)mediaPlayer.getCurrentPosition() / mediaFileLength*100));
if(mediaPlayer.isPlaying()){
Runnable updater = new Runnable() {
#Override
public void run() {
updateSeekBar();
realTimeLength-=1000;
textView.setText(String.format("%d:%d", TimeUnit.MILLISECONDS.toMinutes(realTimeLength),
TimeUnit.MILLISECONDS.toSeconds(realTimeLength) -
TimeUnit.MILLISECONDS.toSeconds(TimeUnit.MILLISECONDS.toMinutes(realTimeLength))));
}
};
handler.postDelayed(updater,1000);
}
}
#Override
public void onBufferingUpdate(MediaPlayer mediaPlayer, int i) {
seekBar.setSecondaryProgress(i);
}
#Override
public void onCompletion(MediaPlayer mediaPlayer) {
imageButton.setImageResource(R.drawable.ic_play);
musicView.stopNotesFall();
}
}
activity_main.xml
<dyanamitechetan.vusikview.VusikView
android:id="#+id/musicView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/textTimer"
android:layout_centerHorizontal="true"
android:text="00:00"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageButton
android:layout_below="#id/textTimer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/btn_play_pause"
android:src="#drawable/ic_play"/>
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/btn_play_pause"
android:id="#+id/seekbar"/>
</RelativeLayout>
you APP connect Internet ?
please check manifest is add internet permission
You can use the mediaplay.setdataSource (url);method directly to load
And setmediaplay.prepareAsync (); use asynchronous method to load music
No need to use AsyncTask
I adding VideoView in fragment but only I get black background nothing more I tried with two codes but both doesn't work can you help me?
PS I don't need play, stop button and anything other just to show the video Here is the code that I add will be good if I can mute the audio of the video and replay
Code 1
package com.Hristijan.Aleksandar.GymAssistant.Exercises;
import android.media.session.MediaController;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.VideoView;
import java.net.URL;
/**
* A simple {#link Fragment} subclass.
*/
public class BenchFragment extends Fragment {
private VideoView MyVideoView;
public BenchFragment() {
// Required empty public constructor
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_bench, container, false);
MyVideoView = (VideoView)rootView.findViewById(R.id.video_view);
Uri uri= Uri.parse("android.resource://"+getActivity().getPackageName()+"/"+R.raw.bench);
MyVideoView.setVideoURI(uri);
MyVideoView.start();
return inflater.inflate(R.layout.fragment_bench, container, false);
}
}
Code2
package com.hristijan.aleksandar.gymworkout.myapplication;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.VideoView;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
private VideoView MyVideoView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MyVideoView = findViewById(R.id.videoViewId);
Uri uri = Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.bench);
MyVideoView.setVideoURI(uri);
MyVideoView.start();
}
}
Layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#000000"
tools:context="com.Hristijan.Aleksandar.GymAssistant.Exercises.BenchFragment">
<VideoView
android:id="#+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
Try this to play,replay and identify the error
private void startVideo() {
String path = "android.resource://" + getPackageName() + "/" + R.raw.crop;
// Log.e(TAG,Uri.parse(path) + " ");
video_view.setVideoURI(Uri.parse(path));
video_view.start();
video_view.setOnErrorListener(new MediaPlayer.OnErrorListener() {
#Override
public boolean onError(MediaPlayer mp, int i, int i1) {
Log.e(TAG,String.format("Error: What: %d, Extra: %d",i,i1));
return false;
}
});
video_view.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
#Override
public void onCompletion(MediaPlayer mp) {
mp.start();
}
});
}
If the video doesn't play it should log error in LogCat. You can identify what kind of error using this doc
About Muting the Audio
You can refer to this Question basically you just need to get the media player object when the content is ready then you can mute the audio by setting m.setVolume(0f, 0f);
I am sure that Code 1 and Code 2 can work
First, make sure your video format is Supported Media Formats
Then, make sure your video file bench stored in ...app\src\main\res\raw (And your file name should be bench not bench.xxx)
On the other hand, in Code 2 something is wrong:
MyVideoView = findViewById(R.id.videoViewId);
should be
MyVideoView = findViewById(R.id.video_view);
in order to find a VideoView by correct Id
Try putting videoView.start() inside videoView.setOnPreparedListener() as:
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener(){
#Override
public void onPrepared(MediaPlayer mediaPlayer){
videoView.start();
}
});
I am trying to have a TextView displayed on top (overlay) of a VideoView, and it is not happening. I have the two elements inside of a FrameLayout with the TextView positions below the VideoView. From my understanding, this is supposed to place it on top.
I have tried various ways of adding the TextView programmatically and removing the additional features of the VideoView e.g. onTouchListener().
Does anyone have any suggestions on how to fix this problem or an explanation of overlaying views that could help me with this problem? Any help would be greatly appreciated. I have posted code below:
activity_splash.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.androidtitan.hotspots.Activity.SplashActivity">
<VideoView
android:id="#+id/splashVideo"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView android:id="#+id/splashTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_marginTop="25dp"
android:text="placeholder text"
android:textSize="60dp"
android:textStyle="bold"
android:textColor="#android:color/black"/>
SplashActivity.java
package com.androidtitan.hotspots.Activity;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.VideoView;
import com.androidtitan.hotspots.R;
public class SplashActivity extends Activity {
private static final String TAG = "hotspots";
TextView titleTextView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
titleTextView = (TextView) findViewById(R.id.splashTitle);
try{
splashScreen();
} catch (Exception e) {
//todo: we could display a picture here as an alternative
Log.e(TAG, String.valueOf(e));
}
//this returns
if(titleTextView.isShown()) {
Log.e(TAG, "titleTextView.isShown()");
}
else {
Log.e(TAG, "NOT SHOWN");
}
}
#Override
public boolean onTouchEvent(MotionEvent ev) {
return false;
}
public void splashScreen() {
VideoView videoHolder = new VideoView(this);
setContentView(videoHolder);
Uri video = Uri.parse("android.resource://" + getPackageName() + "/"
+ R.raw.splash);
videoHolder.setVideoURI(video);
videoHolder.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
jumpMain(); //jump to the next Activity
}
});
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
videoHolder.setLayoutParams(new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
videoHolder.start();
videoHolder.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
((VideoView) v).stopPlayback();
jumpMain();
return true;
}
});
}
private synchronized void jumpMain() {
Intent intent = new Intent(SplashActivity.this, ChampionActivity.class);
startActivity(intent);
finish();
}
}
You are creating a new VideoView instead of using the one in your XML layout and also calling setContentView which replaces the XML layout which loaded first with your new VideoView. That's why its failing. Do not call setContentView twice and change your code as below
public void splashScreen() {
VideoView videoHolder = (VideoView) findViewById(R.id.splashVideo);
Uri video = Uri.parse("android.resource://" + getPackageName() + "/"
+ R.raw.splash);
videoHolder.setVideoURI(video);
videoHolder.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
jumpMain(); //jump to the next Activity
}
});
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
videoHolder.setLayoutParams(new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
videoHolder.start();
videoHolder.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
((VideoView) v).stopPlayback();
jumpMain();
return true;
}
});
}
I am trying to create a RTSP player for Android, but I am getting the error Video Can't be played. I don't know whats the mistake I am making, this is simply not working, I tried all methods, I am giving the code below
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.widget.MediaController;
import android.widget.VideoView;
public class MainActivity extends Activity {
VideoView myVideoView;
ProgressDialog progDailog;
AudioManager audio;
MediaController mediaController;
String unStringUrl="rtsp://his.dvrdns.org:8554/channel/2";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myVideoView = (VideoView)findViewById(R.id.videoplayer);
progDailog = ProgressDialog.show(MainActivity.this, null, "Video loading...", true);
audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mediaController = new MediaController(this);
myVideoView.setMediaController(mediaController);
myVideoView.setVideoURI(Uri.parse(unStringUrl));
myVideoView.requestFocus();
myVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer arg0) {
// called too soon with rtsp in 4.1
if(progDailog != null) {
progDailog.dismiss();
}
myVideoView.start();
}
});
myVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
/*Intent intent = new Intent(MyVideoView.this, lastActivity);
intent.putExtra("cleTitre", activityTitle);
intent.putExtra("cleSegment", activityCat);
startActivity(intent);*/
}
});
myVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
public boolean onError(MediaPlayer mp, int what, int extra) {
if(progDailog != null) {
progDailog.dismiss();
}
return false;
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
You can try including internet -Permisison line in (following line) in your app's Manifest File.In my case it worked.
uses-permission android:name="android.permission.INTERNET"
Hope this helps.
I have 2 tabs each containing videoView. But when I switch to the second tab the video plays the audio is working, but the video doesn't plays and the view is only black. This works fine in Android 2.1 + , but it does't in 1.6 Here is my code:
TabActivity:
package com.example.tab;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
public class main extends TabActivity {
/** Called when the activity is first created. */
private TabHost tabHost;
public void onCreate( Bundle savedInstanceState){
super.onCreate(savedInstanceState);
tabHost = getTabHost();
Intent intent1 = new Intent(this, Video1.class);
Intent intent2 = new Intent(this, Video2.class);
tabHost.addTab(tabHost.newTabSpec("Tab1")
.setIndicator("Video1")
.setContent(intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)));
tabHost.addTab(tabHost.newTabSpec("Tab2")
.setIndicator("Video2")
.setContent(intent2.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)));
}
}
Video1 activity:
/**
*
*/
package com.example.tab;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SurfaceHolder;
import android.view.View;
import android.widget.MediaController;
import android.widget.VideoView;
/**
* #author lyubomir.todorov
*
*/
public class Video1 extends Activity implements SurfaceHolder.Callback {
private String path = "http://xxx.xxx";
private VideoView mVideoView;
private SurfaceHolder holder;
private static final int INSERT_ID = Menu.FIRST;
private static final String TAG = "Tab";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.videoview1);
mVideoView = (VideoView) findViewById(R.id.surface_view1);
// holder = mVideoView.getHolder();
// holder.addCallback(this);
// holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(0, INSERT_ID, 0, "FullScreen");
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
Log.d(TAG, "Player re-started after device configuration change");
return true;
}
#Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
#Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
PlayVideo();
Log.d(TAG, "onResume Video1");
}
protected void onPause() {
super.onDestroy();
Log.d(TAG, "onPause Video1");
if (mVideoView != null) {
mVideoView.stopPlayback();
mVideoView.setVisibility(View.GONE);
mVideoView=null;
Log.d(TAG, "onPause1 Video1");
}
}
public void surfaceDestroyed(SurfaceHolder surfaceholder) {
holder.isCreating();
Log.d(TAG, "video1 surfaceDestroyed called");
}
public void surfaceCreated(SurfaceHolder holder) {
Log.d(TAG, "Current 1 surfaceCreated called");
Log.d(TAG, Boolean.valueOf(holder.isCreating()).toString());
// playVideo(extras.getInt(MEDIA));
}
public void PlayVideo() {
mVideoView.setVideoPath(path);
mVideoView.start();
mVideoView.setMediaController(new MediaController(this));
mVideoView.setVisibility(View.VISIBLE);
}
#Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
Log.d(TAG, Boolean.valueOf(holder.isCreating()).toString());
// TODO Auto-generated method stub
Log.d(TAG, "Current video surfaceChanged called");
}
}
videoview1.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView android:id="#+id/surface_view1"
android:layout_width="320dip" android:layout_height="240dip"
/>
</LinearLayout>
Video2 activity:
/**
*
*/
package com.example.tab;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.View;
import android.widget.MediaController;
import android.widget.VideoView;
/**
* #author lyubomir.todorov
*
*/
public class Video2 extends Activity implements SurfaceHolder.Callback {
private String path = "http://xxx.xxx";
private VideoView mVideoView;
private SurfaceHolder holder;
private static final String TAG = "Tab";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.videoview2);
mVideoView = (VideoView) findViewById(R.id.surface_view2);
// holder= mVideoView.getHolder();
// holder.addCallback(this);
// holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
#Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
PlayVideo();
Log.d(TAG, "onResume Video1");
}
protected void onPause() {
super.onPause();
Log.d(TAG, "onPause Video2");
if (mVideoView!=null){
mVideoView.stopPlayback();
mVideoView.setVisibility(View.GONE);
Log.d(TAG, "onPause1 Video2");
}
}
public void surfaceDestroyed(SurfaceHolder surfaceholder) {
holder.isCreating();
Log.d(TAG, "video1 surfaceDestroyed called");
}
public void surfaceCreated(SurfaceHolder holder) {
Log.d(TAG, "Current 1 surfaceCreated called");
Log.d(TAG, Boolean.valueOf(holder.isCreating()).toString());
}
public void PlayVideo() {
mVideoView.setVisibility(View.VISIBLE);
mVideoView.bringToFront();
mVideoView.setVideoPath(path);
mVideoView.start();
mVideoView.setMediaController(new MediaController(this));
}
#Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
Log.d(TAG, Boolean.valueOf(holder.isCreating()).toString());
// TODO Auto-generated method stub
Log.d(TAG, "Current video surfaceChanged called");
}
}
videoview2.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView android:id="#+id/surface_view2"
android:layout_width="320dip" android:layout_height="240dip"
/>
</LinearLayout>