open-webrtc-toolkit / owt-client-native

Open WebRTC Toolkit client SDK for native Windows/Linux/iOS applications.
https://01.org/open-webrtc-toolkit
Apache License 2.0
394 stars 182 forks source link

iOS: How to mute and unmute the video after start publishing the data #380

Open IbrahimSulai opened 4 years ago

IbrahimSulai commented 4 years ago

Hi,

My requirement is to mute/unmute the video while publishing the data.

How we can update the localStream using the OWTLocalStream constratins, while publishing data.

  ```
  self.streamConstraint.audio = true
  self.streamConstraint.video = OWTVideoTrackConstraints()
  self.streamConstraint.video!.frameRate = 24;
  self.streamConstraint.video!.resolution = CGSize(width: 640, height: 480)
  self.streamConstraint.video!.devicePosition = .front

   DispatchQueue.main.async{
        self.localStream = OWTLocalStream(constratins: self.streamConstraint, error: nil)
        self.localStream.attach(self.streamView.localStream)
        self.publish()
   }
 ```
flyhuan commented 4 years ago

objc publish has an onSuccess callback, this can get OWTConferencePublication object, than you can call mute/unmute

IbrahimSulai commented 4 years ago

@flyhuan I am performing a P2P connection. I didn't find the methods in the SDK to mute/unmute the audio/video.

Could you please help us with API in the SDK to execute the unmute/mute the audio/video in the P2P connection.

yanbin7 commented 4 years ago

Here is answer for your question

  1. mute/unmute only supported in conference mode here is mute/unmute description mute:onSuccess:onFailure: : OWTConferencePublication , OWTConferenceSubscription unmute:onSuccess:onFailure: : OWTConferencePublication , OWTConferenceSubscription

  2. update event also only supported in conference mode Generally speaking, if the stream which published e.g for iOS sides, if screen rotation happen at publisher sides, the remote stream at receiver sides will updated, it will trigger streamDidUpdate event . Constraints for creating the stream. The stream will not be impacted if changing constraints after it is created. https://software.intel.com/sites/products/documentation/webrtc/ios/interface_o_w_t_local_stream.html#aff07178e7c47abd327faab446c0f7822

IbrahimSulai commented 4 years ago

@yanbin7 - Thanks for the clarifications.