0
조각에서 나는 비디오 뷰를 가지고 있으며 기록 된 부엉이 에뮬레이터 카메라 .mp4 비디오를 재생합니다. 모든 것이 잘되고 에뮬레이터에서 비디오가 재생되지만 실제 장치에서 다른 비디오를 재생하려고 할 때 내 카메라를 .mp4 형식으로 다시 레코딩하면 화면이 어두워지고 슬픈 "BitmapFactory class. source not found"가 표시됩니다. 4.0.4 장치에서 테스트 중이며 대상은 8-17 api입니다. 이미지가 에뮬레이터와 실제 장치에서 잘 열리고 있습니다. 없음 로그 캣 오류가 모두 ... 녹색 없습니다실제 기기에서만 VideoView 오류가 발생했습니다.
조각 코드
public class PreviewFragment extends Fragment {
View view;
//variable
File file;
boolean image;
//views
VideoView videView;
ImageView imageView;
ImageButton imageButton;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if(container == null) {
return null;
}
view = inflater.inflate(R.layout.fragment_preview, container, false);
//elements
imageView = (ImageView) view.findViewById(R.id.imageView1);
videView = (VideoView) view.findViewById(R.id.videoView1);
//variables from activity
file = ((PreviewActivity)getActivity()).file;
image = ((PreviewActivity)getActivity()).image;
//main run
if(image == true) {
imageView.setImageURI(Uri.parse(file.getAbsolutePath()));
}
else {
videView.setVideoURI(Uri.parse(file.getAbsolutePath()));
videView.setMediaController(new MediaController(getActivity()));
videView.requestFocus();
videView.start();
}
return view;
}
}
및 XML 코드 내가 조각에서 비디오를 재생하는 경우 4.1 에뮬레이터에서,
<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"
android:background="@color/black" >
<VideoView
android:id="@+id/videoView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:contentDescription="@string/text_fullscreen" />