0
1

More than 3 years have passed since last update.

通話機能 OverconstrainedError Deviceidの解決方法

Last updated at Posted at 2021-03-29

はじめまして、プログラミング初心者のコージです。今回はデバイス選択通話機能を実装するうえで苦労したOverconstrainedError Deviceidの解決方法を忘備録として残しておきます。
苦労したとはいってもコードの改変はたった1行です笑

call.js
      let audioId = $('#audioSource').val();
      let videoId = $('#videoSource').val();
      let constraints = {
          audio: {deviceId: {exact: audioSource}}, <-ここの記述を変更
          video: {deviceId: {exact: videoSource}} 
call.js
      let audioId = $('#audioSource').val();
      let videoId = $('#videoSource').val();
      let constraints = {
        audio: {
            deviceId: audioId <-exactを削除
           },
        video: { 
            deviceId: videoId <-exactを削除
           }

まさかこれだけで3日苦しんだエラーが解決するとは、、、😭
Chromeでこの形式で指定できるようになったのはごく最近らしいです。上が以前の指定形式らしい。
古いから制約に引っ掛かるのかな?

全てのコードを見たい方はgithubのapp->javascriptからどうぞ
ビデオ通話機能を実装したwebアプリケーションのコード: circlefriends

以上

twitter: @siron_www 日常のこともつぶやいてるので友達感覚でフォローしてください😁

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1