**
在AndroidManifest.xml中注册
**
<!-- TBS播放器 -->
<activity
android:name="com.tencent.smtt.sdk.VideoActivity"
android:alwaysRetainTaskState="true"
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="false"
android:launchMode="singleTask">
<intent-filter>
<action android:name="com.tencent.smtt.tbs.video.PLAY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
直接调用播放视频
//判断当前是否可用
if(TbsVideo.canUseTbsPlayer(context)){
//播放视频
Bundle extraData = new Bundle();
extraData.putInt("screenMode",103);
TbsVideo.openVideo(context, filePath,extraData);
}
关于screenMode的做了几个尝试,不添加extraData时,自动竖屏全屏播放,要退出需要双击屏幕暂停后才会弹出选项框。screenMode=102时,竖屏全屏播放,有选项边框。
screenMode=103时,横屏全屏播放,有选项边框,但双击暂停后再次播放会崩溃。
screenMode=104时,竖屏全屏播放,有选项边框,没发现和102的区别。
screenMode=105时,竖屏全屏播放,为默认,和不添加一致。