//index.js
//获取应用实例
const app = getApp()
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
clickMe: function () {
this.setData({ msg: "我的程序!" })
wx.createLivePusherContext(this).start;
},
statechange(e) {
this.setData({ msg: e.detail.code })
console.log('live-pusher code:', e.detail.code)
},
//事件处理函数
bindViewTap: function() {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad: function () {
if (app.globalData.userInfo) {
this.setData({
userInfo: app.globalData.userInfo,
hasUserInfo: true
})
} else if (this.data.canIUse){
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userInfoReadyCallback = res => {
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
} else {
// 在没有 open-type=getUserInfo 版本的兼容处理
wx.getUserInfo({
success: res => {
app.globalData.userInfo = res.userInfo
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
}
/**
// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
wx.getSetting({
success(res) {
if (!res.authSetting['scope.record']) {
wx.authorize({
scope: 'scope.record',
success() {
// 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
wx.startRecord()
}
})
}
}
})
wx.openSetting({
success: (res) => {
}
})
*/
},
getUserInfo: function(e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
})
没有合适的资源?快使用搜索试试~ 我知道了~
微信小程序直播
共12个文件
js:4个
wxss:3个
json:3个
1星 需积分: 14 66 下载量 25 浏览量
2018-03-29
14:35:21
上传
评论
收藏 5KB RAR 举报
温馨提示
微信小程序,通过配置rtmp直播地址流,直接将摄像头采集的视频推到后台直播平台
资源推荐
资源详情
资源评论
收起资源包目录
小程序.rar (12个子文件)
小程序
app.json 241B
pages
index
index.js 2KB
index.wxss 268B
index.wxml 251B
logs
logs.js 261B
logs.json 52B
logs.wxml 173B
logs.wxss 106B
app.wxss 194B
app.js 1KB
project.config.json 548B
utils
util.js 472B
共 12 条
- 1
资源评论
- 阿桂有点桂2018-04-09没什么卵用,骗积分的bitstrong9002018-06-15你自己打开运行了吗?不要乱说
bitstrong900
- 粉丝: 8
- 资源: 39
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功