3

I want to find out if the VideoTrack contains a screenshare or webcam stream. I can't find any attribute and also no fitting contraint I could apply to the track and read out later.

Someone knows a smart way to do that?

I want to avoid sending the streamId with the type over the dataChannel.

Thanks :)

EDIT1: So far no solution... so I have to send the streamType and StreamId over the datachannel

Cracker0dks
  • 2,422
  • 1
  • 24
  • 39

1 Answers1

0

The process works like this (using MediaStreamTrack as an example):

  1. If needed, call MediaDevices.getSupportedConstraints() to get the list of supported constraints, which tells you what constrainable properties the browser knows about. This isn't always necessary, since any that aren't known will simply be ignored when you specify them—but if you have any that you can't get by without, you can start by checking to be sure they're on the list.

  2. Once the script knows whether the property or properties it wishes to use are supported, it can then check the capabilities of the API and its implementation by examining the object returned by the track's getCapabilities() method; this object lists each supported constraint and the values or range of values which are supported.

  3. nally, the track's applyConstraints() method is called to configure the API as desired by specifying the values or ranges of values it wishes to use for any of the constrainable properties about which it has a preference.

  4. The track's getConstraints() method returns the set of constraints passed into the most recent call to applyConstraints(). This may not represent the actual current state of the track, due to properties whose requested values had to be adjusted and because platform default values aren't represented. For a complete representation of the track's current configuration, use getSettings().

In the Media Stream API, both MediaStream and MediaStreamTrack have constrainable properties.

Mithila Eranda
  • 431
  • 3
  • 7
  • ty, but I know that: "I can't find any attribute and also no fitting contraint I could apply to the track and read out later". There are not supported contrains/settings that would fit in chrome or ff I could add to my MediaStreamTrack – Cracker0dks Dec 10 '19 at 12:39