1.准备条件
①iApp会员账号
②设置并选择X5浏览器内核组件
③设置权限
<activity
android:name="com.tencent.smtt.sdk.VideoActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="false"
android:launchMode="singleTask"
android:alwaysRetainTaskState="true">
<intent-filter>
<action android:name="com.tencent.smtt.tbs.video.PLAY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
2.以上条件设置好后,直接在播放按钮设置点击事件,设置如下代码
java(true,null,"com.tencent.smtt.sdk.TbsVideo.canUseTbsPlayer","Context",activity)
f(true)
{
s url="http://uee.me/cEaHd"
//这个是视频地址如果失效请更换地址
javanew(text,"android.os.Bundle")
/.
java(null,text,"android.os.BaseBundle.putBoolean","String","supportLiteWnd","boolean",false)
// false:关闭小窗;true:开启小窗;不设置默认true,
./
java(null,text,"android.os.BaseBundle.putInt","String","screenMode","int",102)
java(null,null,"com.tencent.smtt.sdk.TbsVideo.openVideo","Context",activity,"String",url,"android.os.Bundle",text)
}
else
{
tw("加载tbs播放器失败!")
}
3.注意完成以上步骤后,需要正式打包安装才能播放视频
4.以上是iApp调用Tbs视频播放器的步骤和条件,希望大家喜欢,源码来源于iApp共享空间,本人仅做分析和我分享,如有侵权请指出!