小程序
小游戏
企业微信
微信支付
扫描小程序码分享
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
// 1、引入live-pusher推流组件
<live-pusher
:url="rtmpUrl"
mode="SD"
@statechange="stateChange"
@error="loadError"
:enable-agc="true"
:enable-ans="true"
audio-volume-type="media"
>
// 2、执行初始化直播并开启预览
init() {
this.innerAudioContext = wx.createInnerAudioContext({
useWebAudioImplement: true
})
this.ctx = wx.createLivePusherContext()
this.ctx.startPreview({
success: res => {},
error: error => {
parseError(error)
}
// 3、点击开始录制并播放话术音频
startRecord() {
this.ctx.start({
success: async res => {
// 倒数3后开始播放话术音频
setTimeout(() => {
if (this.isIOS) {
this.innerAudioContext.src = "音频地址url"
this.innerAudioContext.play()
}, 1000)
}, 3000)
},
fail: error => {
本回答由AI生成,可能已过期、失效或不适用于当前情形,请谨慎参考
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
当我们在手机把图2顶部菜单下拉再恢复,声音就可以正常从扬声器播放并且可以录制进去。
iOS微信8.0.59版本升级后 ,ios 原本使用的wx.createInnerAudioContext 音频输出 + wx.createLivePusherContext推流方式,会导致推流后的双录视频,innerAudioContext.play()播放的音频走了听筒模式而且声音很小无法录制进去,但是人说话的声音可以录制进去。然后手动下拉一下手机的顶部状态菜单栏再恢复(查看视频),这样innerAudioContext.play()播放的声音又变成从扬声器播放而且声音比较大;
原先iOS微信低于8.0.59版本的和微信安卓版没有这个问题。
2、下面是在小程序使用的代码描述:
// 1、引入live-pusher推流组件
<live-pusher
:url="rtmpUrl"
mode="SD"
@statechange="stateChange"
@error="loadError"
:enable-agc="true"
:enable-ans="true"
audio-volume-type="media"
>
// 2、执行初始化直播并开启预览
init() {
this.innerAudioContext = wx.createInnerAudioContext({
useWebAudioImplement: true
})
this.ctx = wx.createLivePusherContext()
this.ctx.startPreview({
success: res => {},
error: error => {
parseError(error)
}
})
}
// 3、点击开始录制并播放话术音频
startRecord() {
this.ctx.start({
success: async res => {
// 倒数3后开始播放话术音频
setTimeout(() => {
if (this.isIOS) {
this.innerAudioContext.src = "音频地址url"
setTimeout(() => {
this.innerAudioContext.play()
}, 1000)
}
}, 3000)
},
fail: error => {
parseError(error)
}
})
}