Hi I am trying to play video in PopupWindow but I am getting this error. I am able to play the same video directly in my activity. I found lot of queries related to Cannot Play video but none of them helped me in resolving this issue. Can any one help. Thanks
In my activity.java file I am adding a popupWindow
private PopupVideoView mPopupVideoView;
mPopupWindow = new PopupWindow(this);
mPopupWindow.setContentView(mPopupVideoView.getView());
mPopupWindow.setHeight(360);
mPopupWindow.setWidth(LayoutParams.MATCH_PARENT);
mPopupWindow.setOutsideTouchable(true);
mPopupWindow.setFocusable(true);
In PopupVideoView.java This gives me a view which contains a videoview and start playing the video as soon as i call getView().
public View getView() {
if (mPopupVideoView == null) {
mPopupVideoView = mInflater.inflate(R.layout.videoview_popup, null);
mVideoView = (VideoView)mPopupVideoView.findViewById(R.id.popup_videoView);
}
String uri= "android.resource://" + mContext.getPackageName() + "/" + R.raw.video;
mVideoView.setVideoPath(uri);
mVideoView.start();
mVideoView.setOnErrorListener(new OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
Log.e(mContext.getPackageName(), "Error Occured");
return true;
}
});
return mPopupVideoView;
}
in android 2.3.3 video is audible but not visible and in ICS its not even audible.