1***@qq.com
1***@qq.com
  • 发布:2022-06-16 11:18
  • 更新:2022-06-16 11:54
  • 阅读:436

使用本地音频,在收到推送消息时候即时播放,收到就播放, 自定义音频后,目前只有点击才能播放,收到通知不会播放。

分类:uni-app

UniPush自定义铃声后,消息推送正常,点击后才有响铃,怎么解决?

2022-06-16 11:18 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com (作者)

        var that = this;  
        var orderId = '';  
        var path = '';  
        var random = '';  
        // #ifdef APP-PLUS  
        setTimeout(function() {  
            plus.push.addEventListener('receive', function(msg) {  
                console.log('push--->receive');  
                console.log(msg)  
                let url = 'https://tts.youdao.com/fanyivoice?word=你好&le=zh&keyfrom=speaker-targe';  
                let p = plus.audio.createPlayer(url);  
                p.play();  
                var payload = msg.payload  
                orderId = payload.id  
                path = payload.path  
                random = payload.random  
                var messageTitle = payload.title  
                var messageContent = payload.content  
                setTimeout(function() {  
                    if (that.flag) {  
                        uni.navigateTo({  
                            url: '/pages/order/orderDetail?id=' + orderId +  
                                '&random=' + random  
                        })  
                    } else {  
                        plus.push.createMessage(messageContent, msg.payload, {  
                            title: messageTitle,  
                            sound: "none"  
                        });  
                    }  
                }, 500)  
            }, false);  
            plus.push.addEventListener('click', function(msg) {  
                console.log('push--->click');  
                plus.nativeUI.toast('push click');  
                setTimeout(function() {  
                    uni.navigateTo({  
                        url: '/pages/order/orderDetail?id=' + orderId +  
                            '&random=' + random  
                    })  
                }, 500)  
            }, false);

该问题目前已经被锁定, 无法添加新回复