Intel® Collaboration Suite for WebRTC
Community support and discussions on the Intel® Collaboration Suite for WebRTC (Intel® CS for WebRTC).
1144 Discussions

MCU returns negative ack for unpublishing, Invalid stream id

Ravi_Prakash
New Contributor I
453 Views

Hi Team, 
I m trying to publish a screen-cast to the conference,  where I have already published the local stream. It happens randomly but frequently.

The Error is thrown by OWT.js

 

Here is my code:-       

shareScreenStream(userEmail, roomId) {
        let screenStream;
        let mediaScreenStream;
        // audioConstraintsForScreen
        let audioConstraints = new Owt.Base.AudioTrackConstraints(Owt.Base.AudioSourceInfo.SCREENCAST);
        // videoConstraintsForScreen
        let videoConstraints = new Owt.Base.VideoTrackConstraints(Owt.Base.VideoSourceInfo.SCREENCAST);
        Owt.Base.MediaStreamFactory.createMediaStream(new Owt.Base.StreamConstraints(audioConstraints, videoConstraints)).then(stream => {
            mediaScreenStream = stream; 
            $('#local').srcObject = mediaScreenStream;
            var streamAttribute = {};
            streamAttribute.userName = userEmail;
            streamAttribute.room = roomId;
            streamAttribute.isScreen = true;
            screenStream = new Owt.Base.LocalStream(mediaScreenStream, new Owt.Base.StreamSourceInfo('screen-cast', 'screen-cast'), streamAttribute);
            this.confrence.publish(screenStream).then(publication => {
                //let operation = [{ op: 'replace',path: '/info/layout',value: this.screenShareLayout}];
                let operation = [{ op: 'add',path: '/info/inViews',value: 'common' }];
                OWT_REST.API.updateStream(roomId, publication.id, operation, function(successResp) {
                    console.log("Stream Added to Mix Stream");
                }, function(status, error) {
                        console.log("Cannot Add Stream to Mix Stream", status, error);
                });
                stream.getVideoTracks()[0].onended = function() {
                    stopScreenShare();
                };
                publication.addEventListener('error', (err) => {
                    console.log('Publication error: ' + err.error.message);
                });
                publication.addEventListener('ended', (err) => {
                    stopScreenShare();    
                });
            });             
        }, error => {
            console.log("Error Acessing Screen Media:"+error);
        });
    }

 

I have already published the local stream to conference.

confrence.join(token).then(resp => {
                let connectorId = resp.self.id;
                // audioConstraintsForMic
                let audioConstraints = new Owt.Base.AudioTrackConstraints(Owt.Base.AudioSourceInfo.MIC);
                // videoConstraintsForCamera
                let videoConstraints = new Owt.Base.VideoTrackConstraints(Owt.Base.VideoSourceInfo.CAMERA);                        
                let mediaStream;
                /* initialise the stream constraints */
                Owt.Base.MediaStreamFactory.createMediaStream(new Owt.Base.StreamConstraints(audioConstraints, videoConstraints)).then(localSystemStream => {
                    let publishOption;
                    if (simulcast) {
                        publishOption = {video: [
                                {rid: 'q', active: true, scaleResolutionDownBy: 4.0},
                                {rid: 'h', active: true, scaleResolutionDownBy: 2.0},
                                {rid: 'f', active: true}
                            ]};
                    }
                    mediaStream = localSystemStream;
                    let localStream = new Owt.Base.LocalStream(
                                    mediaStream, new Owt.Base.StreamSourceInfo('mic', 'camera'));
                    console.log("Appending Local stream to video object");
                    document.getElementById(videoTagId).srcObject = localSystemStream;
                    confrence.publish(localStream, publishOption).then(publication => {
                        //publicationGlobal = publication;
                        // inform confrence room to accomodate new stream 
                        let operation = [{ op: 'add',path: '/info/inViews',value: 'common' }];
                        OWT_REST.API.updateStream(roomId, publication.id, operation, function(successResp) {
                            console.log("Stream Added to Mix Stream");
                        }, function(status, error) {
                                console.log("Cannot Add Stream to Mix Stream", status, error);
                        });
                        publication.addEventListener('error', (err) => {
                            console.log('Publication error: ' + err.error.message);
                        });
                    });                                         
                }, err => {
                    console.error('Failed to create Local MediaStream, ' + err.message);
                    conference.leave();  
                });

 

The error is :

Ravi_Prakash_0-1633087818978.png

 

Ravi_Prakash_1-1633087874338.png

 

Please suggest what to do?

 

- Ravi

+91-9911990190

0 Kudos
0 Replies
Reply