Skip to content

Commit

Permalink
webrtc-manager: Assing 'motion' contentHint to video tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Jul 25, 2023
1 parent 214283e commit ebb0ca5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/composables/webRTC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,17 @@ export class WebRTCManager {
const [remoteStream] = event.streams
this.mediaStream.value = remoteStream

// Assign 'motion' contentHint to media stream video tracks, so it performs better on low bandwith situations
// More on that here: https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/contentHint
const videoTracks = this.mediaStream.value.getVideoTracks().filter((t) => t.kind === 'video')
videoTracks.forEach((track) => {
if (!('contentHint' in track)) {
console.error('MediaStreamTrack contentHint attribute not supported.')
return
}
track.contentHint = 'motion'
})

console.groupCollapsed('[WebRTC] Track added')
console.debug('Event:', event)
console.debug('Settings:', event.track.getSettings?.())
Expand Down

0 comments on commit ebb0ca5

Please sign in to comment.