ionorg / ion-sdk-js

ion javascript sdk
MIT License
102 stars 70 forks source link

sreen shareing #195

Closed aliaaaaaaaaa closed 1 year ago

aliaaaaaaaaa commented 3 years ago

how we can sreeen share to other peer

adwpc commented 3 years ago

https://github.com/pion/ion-app-web/blob/a2e26d13bf4e7696b8cd23ff3887cd53b3599862/src/Conference.jsx#L126

aliaaaaaaaaa commented 3 years ago

https://github.com/pion/ion-app-web/blob/a2e26d13bf4e7696b8cd23ff3887cd53b3599862/src/Conference.jsx#L126

const localVideo = document.getElementById("local-video");

    const serverUrl = "wss://test.ir/sfu-ws";

    const signalLocal = new IonSFUJSONRPCSignal(serverUrl)

    this.clientLocal = new Client(signalLocal);
    let clientLocal = this.clientLocal
    signalLocal.onopen = () => {
      clientLocal.join("test 1")
      console.log("test")
    };
    const streams = {};

    let constraints;
    LocalStream.getDisplayMedia(constraints = {
      codec: 'vp8',
      resolution: 'hd',
      audio: true,
      video: true,
      simulcast: false,
    })

        .then((media) => {
          this.stream = media;
          localVideo.srcObject = media;
          localVideo.autoplay = true;
          localVideo.controls = true;
          localVideo.muted = true;
          clientLocal.publish(media);
        })
        .catch(console.error);

this is code i use for screen sharing but it not working can you tell me why?

jason-shen commented 2 years ago

LocalStream.getDisplayMedia({ codec: 'vp8', resolution: 'hd', audio: true, video: true, simulcast: false, })

jason-shen commented 2 years ago

try that you don't need that constraints =