videoview로 웹에있는 영상 재생시 동영상을 재생할수 없습니다. 라는 팝업이뜹니다...
웹뷰로도 실행해봤는데 소리만 나오고 영상은 출력이안되네요 ㅜㅜ 구글링에서 동원할 수 있는 방법은 다 동원해본거같습니다!! 우선 최종적으로 필요없는거 뺀 소스코드입니다.. 진짜 이거가지고 5일내내 1시간 자면서 고민했는데 해결이안되요 ㅜㅜ 과제 제출이 담주 수요일인데 담주 월요일부터 기말기간이라 주말엔 공부해야되고.. 오늘 내일 중에 해결되면 좋겠습니다 ㅜ
package com.example.yyych.make_body;
import android.app.Activity;
import android.app.ProgressDialog;
import android.graphics.PixelFormat;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.TextView;
import android.widget.VideoView;
public class VideoActivity extends Activity {
private String url, description;
TextView descriptionText;
VideoView videoView;
private static ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video);
url = getIntent().getStringExtra("URL");
description = getIntent().getStringExtra("DESCRIPTION");
descriptionText = (TextView) findViewById(R.id.textDescription);
if(Build.VERSION.SDK_INT >= 11)
{
getWindow().addFlags(16777216);
}
descriptionText.setText(description);
videoView = (VideoView) findViewById(R.id.videoView1);
progressDialog = ProgressDialog.show(VideoActivity.this, "", "Buffering video...", true);
progressDialog.setCancelable(true);
PlayVideo();
}
private void PlayVideo()
{
try
{
getWindow().setFormat(PixelFormat.TRANSLUCENT);
MediaController mediaController = new MediaController(VideoActivity.this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse(url);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.requestFocus();
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener()
{
public void onPrepared(MediaPlayer mp)
{
progressDialog.dismiss();
videoView.start();
}
});
}
catch(Exception e)
{
progressDialog.dismiss();
System.out.println("Video Play Error :"+e.toString());
finish();
}
}
}
아래는 video.xml파일입니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<VideoView
android:id="@+id/videoView1"
android:layout_width="match_parent"
android:layout_height="280dp">
</VideoView>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/textDescription"
android:layout_width="match_parent"
android:layout_height="170dp"
android:gravity="center"
android:text=""
android:textSize="18dp"/>
</ScrollView>
</LinearLayout>
에러는...
06-09 08:21:14.630 2573-2573/com.example.yyych.make_body D/VideoView: Error: 1,0
06-09 08:21:14.685 2573-2573/com.example.yyych.make_body I/Choreographer: Skipped 184 frames! The application may be doing too much work on its main thread.