Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

how to share screen to other user #39

Open
jamesctl opened this issue Sep 24, 2021 · 0 comments
Open

how to share screen to other user #39

jamesctl opened this issue Sep 24, 2021 · 0 comments

Comments

@jamesctl
Copy link

I down load the source code and try to share screen on meeting, but I only see my screen, other user can not see.
this is code:
when user click on button share screen

<button class="mdc-button mdc-button--raised"  id="startButton">
        <i class="material-icons mdc-button__icon" aria-hidden="true">close</i>
        <span class="mdc-button__label">sharing</span>
    </button>
<video id="sharing-video" autoplay playsinline muted></video>
<script>
const videoShareScreen = document.querySelector('video');
startButton.addEventListener('click', () => {
 navigator.mediaDevices.getDisplayMedia({ screen: true,screenAudio: true}).then(handleSuccess, handleError);
})
function handleSuccess(stream) {
  startButton.disabled = true;
  

  // demonstrates how to detect that the user has stopped
  // sharing the screen via the browser UI.
  
    videoShareScreen.srcObject = stream;
    

  stream.getVideoTracks()[0].addEventListener('ended', () => {
    errorMsg('The user has ended sharing the screen');
    startButton.disabled = false;
  });
}
function handleError(error) {
  errorMsg(`getDisplayMedia error: ${error.name}`, error);
}
</script>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant