Screen sharing from browser and stream unpublished event

Evgenii

New Member
Hi, I'm publishing Flashphoner stream (screen share) from Chrome browser. It works well except one thing: if I revoke access to share my screen (via browser-provided panel in the bottom of the screen, by pressing blue button) - there are no events about stream being unpublished, neither on client nor on server. On client, nor "on(STREAM_STATUS.UNPUBLISHED)" handler nor ".on(STREAM_STATUS.FAILED)" are invoked, and on server no event hooks (StreamStatusEvent, unpublishStream) are invoked either. Actual stream is interrupted however. Is there a way to catch stream unpublish event in this case?
 

Max

Administrator
Staff member
Hello,

Tried this with WCS 5.2.526 and Chrome 80 using the demo Screen Sharing example: STREAM_STATUS.UNPUBLISHED is invoked when sharing is stopped on clicking the blue [Stop sharing] button.
Please confirm if the issue is reproducible with the demo example and let know the Web SDK and Chrome versions.
 

Evgenii

New Member
Can confirm UNPUBLISHED event indeed is fired on client side in demo example. Then I probably need to provide more details for my case. I initiate session like this:

Code:
constraints = {
                video: {
                    type: "screen",
                    withoutExtension: true
                }
            };
Code:
        let display = <HTMLVideoElement> $("<video>")[0];       
        session.createStream({
            name: streamKey,         
            display: display,
            receiveVideo: false,
            receiveAudio: false,           
            constraints: constraints,
        }).on(STREAM_STATUS.PUBLISHING, (publishStream) => {           
            console.log("FP stream publish started");           
            this._onStarted(publishStream, taskId);
            resolve();           
        }).on(STREAM_STATUS.UNPUBLISHED, () => {
            console.log("FP stream publish stopped");                       
            this._onStopped();
        }).on(STREAM_STATUS.FAILED, () => {
            console.log("FP stream publish failed");                       
            this._onStopped();
            reject();
        }).publish();
I create a dummy disconnected `<video>` tag, because I don't need to display that stream anywhere in interface, but if I pass null as "display" parameter to create session - it fails. So with this code I don't see "FP stream publish stopped" message in console, but more importantly I don't see any events at server side.
 
Top