shinyoshiaki / skyway-red

MIT License
1 stars 0 forks source link

TypeError: Cannot read properties of undefined (reading 'mimeType') #2

Closed yanoyuki closed 2 years ago

yanoyuki commented 2 years ago

発生内容

以下のエラーが発生します。

Uncaught TypeError: Cannot read properties of undefined (reading 'mimeType')
    at SkyWayRED.senderTransform (index.js:80:1)
    at index.js:47:1
    at Array.forEach (<anonymous>)
    at RTCPeerConnection.<anonymous> (index.js:42:1)

スクリーンショット 2022-07-25 22 23 38

コード

import { SkyWayRED } from '@shinyoshiaki/skyway-red'
...
export const createSkywayRED = () => {
  const skywayRED = new SkyWayRED({
    useAdaptiveRedDistance: true,
    redDistance: 3,
  })
  return skywayRED
}
const skywayRED = createSkywayRED()
...
mediaconnection.answer(undefined)
skywayRED.activateRED(mediaConnection)  // ここで上記エラーが発生

Peerは以下のように生成しています。

  const peer = new Peer(peerId, {
    key: API_KEY,
    config: { encodedInsertableStreams: true },
    debug: DEBUG_LEVEL,
  })

環境

ブラウザ: Google Chrome バージョン: 103.0.5060.114

package.json

...
"@shinyoshiaki/skyway-red": "^0.1.3",
...
"skyway-js": "^4.4.4",
shinyoshiaki commented 2 years ago

片方向の通話を考慮した設計になっていないので、mediaconnection.answer(undefined)を実行するのではなくanswerにはMediaStreamを渡してください