The introduction of uni-app development program of small micro-channel Tencent video player plug-in applet

Login small micro-channel program management background to add Tencent video player plug-ins:

  Before the official start must first use Tencent video applet plug-in micro-channel public platform - adding plug-ins, as shown below> Plug Administration -> Third-party setting:

 Introduction of plug-in code in the uni-app:

  Note that when using uni-app development micro-channel small program and will use micro-letter web development tools to develop micro-channel small program is very different direct, since uni-app reasons for multi-platform can be developed, so the corresponding configuration of the development of different platforms required into the designated position to be able to take effect. Introducing the uni-app Tencent video Applets There are two ways one is used throughout the applets (applet can use all sub), corresponding to a second specified sub may be used.

Specifies that the entire applet can be used:

To declare the use of plug-in mp-weixin manifest.json Before using the plug-in, developed with reference to the specific configuration documentation plug-in with:

"mp-weixin": {
		/ * Configuration applet * /
		"UsingComponents": true, // whether to enable custom component mode
		"Appid": "applets AppID",
		"plugins": {
			"tencentvideo": {
				"version": "1.3.6",
				"Provider": "Tencent video applet AppID"
			}
		}
	}

Assigned to the corresponding sub-use:

If the plug only (the same plug can not be simultaneously a plurality of sub reference) uses a subcontract, the subcontract can be configured separately, so that the plugin does not load with the main package may be pages.jsona subPackages declared widget:

{
  "subpackages": [
    {
      "root": "package1",//分包名称
      "pages": [
        "pages/cat",
        "pages/dog"
      ],
      "plugins": {
        "tencentvideo": {
          "version": "1.3.6",
          "provider": "腾讯视频小程序AppID"
        }
      }
    }
  ]
}  

在pages.json全局配置文件中对要使用插件的页面配置如下条件编译代码:  

"usingComponents": {
	// #ifdef  MP-WEIXIN 
	   "txv-video": "plugin://tencentvideo/video"
	// #endif
},

 在.vue页面中使用腾讯视频播放组件:

<view>
           <!--vid中的腾讯视频id最好为动态的数据,方便管理-->
          <txv-video :vid="VideoId" playerid="txv1"></txv-video>
</view>


<script>
export default {
	data() {
		return {
			VideoId:'c3029q7tdnp'
		};
	}
}
</script>   

关于如何获取腾讯视频vid问题:

打开网页腾讯视频=>随便找到一个视频点击鼠标右键=>赋值链接地址(仅供参考)如下图所示:

 

 最后取视频连接地址.html前面的那一小串英文数字编号即可,下图所示:

 参考资料:

腾讯视频小程序播放插件开发文档:

https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wxa75efa648b60994b&token=&lang=zh_CN

decloud uni-app相关配置:

https://uniapp.dcloud.io/component/mp-weixin-plugin

微信小程序特有配置:

https://uniapp.dcloud.io/collocation/manifest?id=mp-weixin

Guess you like

Origin www.cnblogs.com/Can-daydayup/p/12046831.html