在2天之后,在我看来,寻找一种独一无二的方式来做到这一点:
public CustomViewCallback mCustomViewCallback;
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
super.onShowCustomView(view, callback);
if (view instanceof FrameLayout) {
FrameLayout customViewContainer = (FrameLayout) view;
mCustomViewCallback = callback;
if (customViewContainer.getFocusedChild() instanceof VideoView) {
VideoView customVideoView = (VideoView) customViewContainer.getFocusedChild();
try {
Field mUriField = VideoView.class.getDeclaredField("mUri");
mUriField.setAccessible(true);
Uri uri = (Uri) mUriField.get(customVideoView);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "video/*");
mActivity.startActivity(intent);
new Handler().post(new Runnable() {
@Override
public void run() {
mCustomViewCallback.onCustomViewHidden();
}
});
} catch (Exception e) {
}
}
}
}
希望......
PS:Tube工程