Fix bug: can't play video in obbfile. (#19476) (#19586)

* Fix bug: can't play video in obbfile.

* Change check order.
This commit is contained in:
minggo 2019-04-09 22:38:32 -07:00 committed by GitHub
parent 4bb958fe29
commit 86a9e0c1b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -297,6 +297,9 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
mCurrentBufferPercentage = 0;
if (mIsAssetRouse) {
AssetFileDescriptor afd = mCocos2dxActivity.getAssets().openFd(mVideoFilePath);
if (afd == null && Cocos2dxHelper.getObbFile() != null) {
afd = Cocos2dxHelper.getObbFile() .getAssetFileDescriptor(mVideoFilePath);
}
mMediaPlayer.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
} else {
mMediaPlayer.setDataSource(mCocos2dxActivity, mVideoUri);