Opentok onstreamCreated订阅使移动Chrome冻结 [英] Opentok on streamCreated subscribe makes mobile chrome freeze

查看:86
本文介绍了Opentok onstreamCreated订阅使移动Chrome冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在opentok平台和vue.js上开发webRTC聊天.尽管在桌面和移动版Firefox浏览器上一切正常,但尝试订阅event.stream时,移动chrome挂断了.奇怪的是,如果我激活开发人员工具,那么它将按预期在移动chrome上运行,因此我无法调试该工具上的错误日志.我已经为此花了三天时间.如果有人可以帮助我,我将不胜感激!这是我的代码的相关部分:

I am developing webRTC chat on opentok platform and vue.js. While everything is fine on desctop and mobile firefox browser, mobile chrome gets hung up when trying to subscribe to the event.stream. The weird thing is that if I activate developer tools then it will work on mobile chrome as expected so I can not debug error log on this one. I have been racking my brain on this for three days now. If anyone can help me I would appreciate it! Here is the relevant part of my code:

    //start the live vicdeo sessiion
    startLivevideoSession: function(session){

        this.call = true; //set call to true

        //initiate opentok session
        this.LiveVideo_session = OT.initSession(session.apiKey, session.session)

        //define on streamcreated method
        this.LiveVideo_session.on('streamCreated', function(event) {

                //this is the problem:
                this.LiveVideo_session.subscribe(event.stream, 'stream_video1', {
                      height: '100%',
                      width: '100%',
                      showControls: true,
                      style: {
                        audioLevelDisplayMode: 'auto',
                        buttonDisplayMode: 'off',
                        nameDisplayMode: 'off',
                        videoDisabledDisplayMode: 'auto',
                        showArchiveStatus: false
                      }
                }, this.handleError)
                //problem ends


            }.bind(this))

        //define on sessionDisconnected method
        this.LiveVideo_session.on("sessionDisconnected", function (event) {

                if(this.call){
                    this.stopVideoButtonPress() //stop on going chat session if any
                    bus.$emit('showModal', "stopLivevideoSessionLeft"); //notify user that other user left the page
                }
            }.bind(this))

        //define connect method
        this.LiveVideo_session.connect(session.token, function(error) {

                if(error){
                    this.handleError(error)
                }else{

                    //if call mode is chat, do not publish chat at all
                    if(this.call_mode != 'chat'){
                        this.LiveVideo_session.publish(this.my_video); //publish my video to chatroom
                    }

                    //if testsession, publish stream also to stream_video1
                    if(this.testSession){
                        this.LiveVideo_session.publish(this.test_publisher)
                    }
                }

            }.bind(this));

        //store session.premium_session to premium_session
        this.premium_session = session.premium_session

        //wait for UI elements to be created on page before OT.initPublisher
        setTimeout(() => {
            //setup my_video
            if(this.call_mode == "audio") //if only audio is selected
                var publisherOptions = {
                  videoSource: null,
                  name: this.connection_setup.stream_video_description+" (vain ääni)",
                  width: '100%',
                  height: '100%',
                  opaque: '1',
                  style: {
                    nameDisplayMode: "on",
                    audioLevelDisplayMode: "on",
                    }
                }
                else
                //setup my_video for videochat
                var publisherOptions = {
                  name: this.connection_setup.stream_video_description,
                  width: '100%',
                  height: '100%',
                  opaque: '1',
                  style: {
                    nameDisplayMode: "on",
                    audioLevelDisplayMode: "on",
                    }
                }

            //if call mode is chat, do not publish chat at all
            if(this.call_mode != 'chat'){
                console.log("call mode"+this.call_mode)
                this.my_video = OT.initPublisher('my_video', publisherOptions, this.handleError)
            }

            //if testsession, publish stream also to stream_video1
            if(this.testSession){
                console.log("call testSession "+this.testSession)
                publisherOptions.name = 'Sinun kuvasi keskustelukumppanin näkemänä';
                this.test_publisher = OT.initPublisher('stream_video1', publisherOptions, this.handleError)
            }

        }, 600);

    },

推荐答案

可能是Chrome冻结了,而不是opentok.请参见此chrome 61/android bug ,其中包括以下解决方法:添加边界半径

It might be Chrome that freezes, not opentok. See this chrome 61/android bug which includes a workaround of adding a border-radius

这篇关于Opentok onstreamCreated订阅使移动Chrome冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆