ashqal / MD360Player4Android

It is a lite library to render 360 degree panorama video for Android. VR Player.
Apache License 2.0
1.08k stars 356 forks source link

video大小动态改变 #112

Closed zengxin closed 8 years ago

zengxin commented 8 years ago

我动态改变video view (GLSurfaceView)大小时,发现只是view大小改变了,里面的视频大小没有变化。

zengxin commented 8 years ago

确切的说应该是scale动画有问题,以下是我的测试代码 return MDVRLibrary.with(this) .displayMode(MDVRLibrary.DISPLAY_MODE_NORMAL) .interactiveMode(MDVRLibrary.INTERACTIVE_MODE_MOTION) .asVideo(new MDVRLibrary.IOnSurfaceReadyCallback() { @Override public void onSurfaceReady(Surface surface) { mMediaPlayerWrapper.getPlayer().setSurface(surface); } }) .ifNotSupport(new MDVRLibrary.INotSupportCallback() { @Override public void onNotSupport(int mode) { String tip = mode == MDVRLibrary.INTERACTIVE_MODE_MOTION ? "onNotSupport:MOTION" : "onNotSupport:" + String.valueOf(mode); Toast.makeText(VideoPlayerActivity.this, tip, Toast.LENGTH_SHORT).show(); } }) .pinchEnabled(true) .listenGesture(new MDVRLibrary.IGestureListener() { @Override public void onClick(MotionEvent e) { View videoView = findViewById(R.id.gl_view); PropertyValuesHolder pvhx = PropertyValuesHolder.ofFloat(View.SCALE_X, 0.3f); PropertyValuesHolder pvhy = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.3f); ObjectAnimator scaleAnimation = ObjectAnimator.ofPropertyValuesHolder(videoView, pvhx, pvhy); scaleAnimation.setDuration(500); scaleAnimation.start(); } }) .projectionFactory(new CustomProjectionFactory()) .barrelDistortionConfig(new BarrelDistortionConfig().setDefaultEnabled(false).setScale(0.95f)) .build(R.id.gl_view);

ashqal commented 8 years ago

surface本身就是这样的,你可以设置layout参数

ViewGroup.LayoutParams layoutParams = surfaceView.getLayoutParams();
layoutParams.width = 320;
layoutParams.height = 240;
surfaceView.setLayoutParams(layoutParams);