uniapp-微信小程序直播插件小记

1.在manifest.json中的源码视图添加以下代码块

"plugins": {
    
    
	"live-player-plugin": {
    
    
    	"version": "1.2.10", // 注意填写该直播组件最新版本号,微信开发者工具调试时可获取最新版本号(复制时请去掉注释)
    	"provider": "wx2b03c6e691cd7370" // 直播组件appid,(不用修改,除非微信官方更改)
	}
}

在这里插入图片描述

2.在需要使用直播的页面的pages.json中添加以下代码

"mp-weixin": {
    
    
	"usingSwanComponents": {
    
    
		"live-player-plugin": "plugin://live-player-plugin"
	}
}

在这里插入图片描述

3.页面中请求后端接口(当然也可以前端请求,前提是你能拿到access_token)

相关连接:
(直播间信息及管理:)https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html
(直播组件使用:)https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/live-player-plugin.html

猜你喜欢

转载自blog.csdn.net/z1783883121/article/details/114950217