主视频旋转 90 度后 附加视频方向不一致了

情景

主视频: 1920x1080 rotation 90度
附加视频: 540x960 rotation 0度

  1. 使用 MediaPlayer + DrawPadView 实现播放,
  2. 使用 TwoVideoLayer 实现同时播放主视频和附加视频
    drawPadView.addTwoVideoLayer(mediaPlayer.getVideoWidth(), mediaPlayer.getVideoHeight());

结果如下图:
TwoVideoLayer-error-rotate

附加视频(蝴蝶)横着播放了

暂时修改方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public void addEffect(String effectPath) {
if (effectPlayer == null) {
effectPlayer = new MediaPlayer();
} else {
effectPlayer.stop();
effectPlayer.reset();
}
try {
effectPlayer.setDataSource(effectPath);
twoVideoLayer.setDisplayTexture2(true);
//当前没有完全解决, 只是时间关系, 规避了一下, 可以通过这样来矫正下角度
//更新了 D:\work\lanso.demo\app\libs\lansongeditor_hx.jar
if (mainVideoInfo.vRotateAngle == 90) {
twoVideoLayer.setSecondVideoMirror(Rotation.ROTATION_270, true, false);
} else if (mainVideoInfo.vRotateAngle == 270) {
twoVideoLayer.setSecondVideoMirror(Rotation.ROTATION_90, true, false);
}
effectPlayer.setSurface(new Surface(twoVideoLayer.getVideoTexture2()));
effectPlayer.prepare();
effectPlayer.start();

} catch (Exception e) {
Log.e(TAG, "播放特效失败", e);
}
}