pili-engineering / PLDroidPlayer

PLDroidPlayer 是七牛推出的一款免费的适用于 Android 平台的播放器 SDK,采用全自研的跨平台播放内核,拥有丰富的功能和优异的性能,可高度定制化和二次开发。
https://developer.qiniu.com/pili/sdk/1210/the-android-client-sdk
4.54k stars 953 forks source link

PLOnVideoSizeChangedListener监听 #868

Open panyingdaoz opened 6 years ago

panyingdaoz commented 6 years ago

你好PLOnVideoSizeChangedListener这个监听会在哪些情况下调用呢?我的为什么每次切换播放调用两次。 03-13 14:34:31.873 20002-20135/com.kingbird.advertisting E/VideoTextureActivity.java: [ (VideoTextureActivity.java:824)#timePlay ] 可以播放 03-13 14:34:32.223 20002-20002/com.kingbird.advertisting E/VideoTextureActivity: [ (VideoTextureActivity.java:1205)#onVideoSizeChanged ] onVideoSizeChanged: width = 1280, height = 720 03-13 14:34:32.233 20002-20002/com.kingbird.advertisting E/VideoTextureActivity.java: [ (VideoTextureActivity.java:1212)#onVideoSizeChanged ] 执行播放 03-13 14:34:32.433 20002-20002/com.kingbird.advertisting E/VideoTextureActivity: [ (VideoTextureActivity.java:1205)#onVideoSizeChanged ] onVideoSizeChanged: width = 1280, height = 720 03-13 14:34:32.433 20002-20002/com.kingbird.advertisting E/VideoTextureActivity.java: [ (VideoTextureActivity.java:1212)#onVideoSizeChanged ] 执行播放

zshbleaker commented 6 years ago

理论上来说,打开一个视频会调用两次,第一次是视频原始的分辨率,第二次是根据 DAR 信息计算后的实际比例。大多数情况下两次数据是一致的,之后考虑减少到一次

在 2018年3月13日,14:38,panyingdaoz notifications@github.com 写道:

你好PLOnVideoSizeChangedListener这个监听会在哪些情况下调用呢?我的为什么每次切换播放调用两次。 03-13 14:34:31.873 20002-20135/com.kingbird.advertisting E/VideoTextureActivity.java: [ (VideoTextureActivity.java:824)#timePlay ] 可以播放 03-13 14:34:32.223 20002-20002/com.kingbird.advertisting E/VideoTextureActivity: [ (VideoTextureActivity.java:1205)#onVideoSizeChanged ] onVideoSizeChanged: width = 1280, height = 720 03-13 14:34:32.233 20002-20002/com.kingbird.advertisting E/VideoTextureActivity.java: [ (VideoTextureActivity.java:1212)#onVideoSizeChanged ] 执行播放 03-13 14:34:32.433 20002-20002/com.kingbird.advertisting E/VideoTextureActivity: [ (VideoTextureActivity.java:1205)#onVideoSizeChanged ] onVideoSizeChanged: width = 1280, height = 720 03-13 14:34:32.433 20002-20002/com.kingbird.advertisting E/VideoTextureActivity.java: [ (VideoTextureActivity.java:1212)#onVideoSizeChanged ] 执行播放

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pili-engineering/PLDroidPlayer/issues/868, or mute the thread https://github.com/notifications/unsubscribe-auth/AEEwlnzp1gMm0rYxE3xyQdtzO20sQ0Fnks5td2l5gaJpZM4SoJ7z.

panyingdaoz commented 6 years ago

@zshbleaker 我是在第一次运行播放时,显示只调用一次,后面我在做PLOnCompletionListener调用后播放,就会调用PLOnVideoSizeChangedListener两次

panyingdaoz commented 6 years ago

我与demo测试了下是PLOnCompletionListener后mVideoView.setVideoPath(videoPath);会调用一次,由于直接在PLOnCompletionListener中调用start(mVideoView.start();)是无法播放的,所有我就添加了PLOnPreparedListener这个监听,在这里面再mVideoView.start();所以就会调用两次,你们看看能不处理下在PLOnCompletionListener里(mVideoView.start();)就能播放,就不需要添加PLOnPreparedListener来再调用start方法,就不会执行两次PLOnVideoSizeChangedListener

zshbleaker commented 6 years ago

这个问题在开发版中已经修复,感谢反馈