[Bug]: webRTC not working properly on ios device
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- ios, javascript
調査の方向性
リンクされたcapacitorTestプロジェクト、そのcapacitor.configおよびvite.config.jsから始め、必要なHTTPS設定でnpx vite --port 5173を実行します。iOSデバイスで最初のWebRTCオーディオ再生を再現し、その後Capacitor iOS/WKWebViewの経路を追跡します。初回の再生が途切れずスムーズに行われれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Capacitor Version 7.4.3
INTRODUCTION
Hello from Australia!
My name is Scott and I'm using the sdk @openai/agents-realtime and I'm having a huge problem with it in the capacitor app.
Basically it works perfectly on the android device, google chrome browser and safari browser but on the ios device i have a small bug that i cannot erradicate.
Basically how the app works is that a webRTC is created on the client side and it streams audio from the client side to openAI when the client speaks into the microphone openAI replies back in audio. It's awsome.
THE PROBLEM
The problem I'm having is that when the audio first starts to play on the ios device it stops then starts then stops and starts on the first play. After the first play, it works perfectly.
This is definately a capacitor bug because i can get it to work perfectly in the safari and chrome browsers and on an capacitor app on an android device but it malfunctions on the first audio play on a capacitor app on an ios device.
THE LIKELY CAUSE
The reason for this error is because capacitor apps for ios use a special wrapper (WKWebView) that mimics safari and the reason this error doesn't occur in the safari browser is because safari's audio handling has been built to handle this situation but the wrappers (WKWebView) that are used in frameworks like capacitor haven't been just yet, let me explain this in more detail.......
Safari (the full browser) runs in a long-lived WebKit process that usually has the AVAudioSession already active (or quickly activated) after a user gesture. When WebRTC/audio starts, Safari often has the route + sample rate “hot,” so first playback is smooth.
WKWebView on the otherhand (the wrapper that capacitor and many others are using atm) starts cold and so first audio play from a webRTC will stop and start and stop and start a few times on first play as the audio sets up from scratch each time on first play. So to fix the error it would be pretty easy on your end because all you really need to do is pre-activate the AVAudioSession inside capacitor.
RESOURCES
The sdk is below but in the project I am giving you via github the sdk is provided via cdn so you don't have to install it but the documentation for this sdk is below if you still want to read it:
https://openai.github.io/openai-agents-js/guides/voice-agents/quickstart/
I made a youtube video showing you how it works on everything except ios device.
I have already made you a simple project in capacitor, javascript and html using this library from openAI and you can use this project to debug the problem with capacitor only you will need to create your own openAI client secret key from the openAI console here;
https://platform.openai.com/api-keys
Also because the cdn sdk is using webRTC, the app must be hosted on a https local server not http so therefore you will need to create the two certificates to enable this using the unix comands below from the root directory:
-
Install mkcert (once)
brew install mkcert -
Install the local root CA (once)
mkcert -install -
Create a cert specifically for your IP
mkcert -cert-file ip.pem -key-file ip-key.pem 123.456.78.9 (your ip address on your machine)
I have already completed the imports for these two certificates so you just need to make them and keep them in the root directory.
i have already made all the configurations for ios and android for you to run this project on your own device via xcode and android studio and I have already set up the capacitor.config and vite.config.js files only you will need to put your own ip address there as i have still got mine there.
Here is the project I have built for you so you can use it to debug the issue:
https://github.com/scottywm/capacitorTest.git
To run the project you need to use vite on port 5173, just run the command below from the route directory:
npx vite --port 5173
If you need help getting the project started and have other questions I'm happy to chat with you over a zoom meeting if you like. Just email me at [email protected].
Please action this asap because i've been working on my app all year and im almost finished and now this bug in capacitor is a fatal flaw so please fix it.
Other API Details
Platforms Affected
- iOS
- Android
- Web
Current Behavior
The capacitor app works perfectly on an android device and i can even get it to work perfectly in the chrome and safari browser but when I use capacitor to make it into an app it malfunctions on an ios device when the audio first starts playing. The first audio play on an ios device stops then starts then stops then starts. This is terrible!
Expected Behavior
The audio must play smoothly on both ios and android devices without stops and starts.
Project Reproduction
https://github.com/scottywm/capacitorTest.git
Additional Information
I've been working on this app for nine months staright now and this error is fatal so it must get fixed ASAP!!!
- 主要言語
- TypeScript
- スター
- 17.1k
- フォーク
- 1.3k
- 平均マージ
- 1日 22時間
- マージ済み PR(30日)
- 26
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ionic-team/capacitor のほかの issue
-
triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ionic-team/capacitor#8759 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: Plugin call after navigation can be answered before reply proxy is updated対応中かも @MateStrysewske が 71 日前に担当しました。 オープンtriage
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
ionic-team/capacitor#8616 ·
メンテナーはふだん 1 日以内に返信
-
help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ionic-team/capacitor#8574 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
SystemBars: safe area CSS injection throws "Cannot read properties of null" on startup (Android 16)対応中かも @kttalley が 62 日前に担当しました。 オープンtriage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ionic-team/capacitor#8530 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
fix(android): remove unchecked Java compilation warnings対応中かも @Ajamuar が 15 日前に担当しました。 オープンtriage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ionic-team/capacitor#8529 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
ionic-team/capacitor の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
prio:low scope:world
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
OliverRomhagen/vrigstad-joyride#849 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
genfeedai/genfeed.ai#11916 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
erkamyaman/rust-anything#1153 ·
メンテナーはふだん 1 日以内に返信
-
The Phase 5 report says 0.3.0 waits for the live check対応中かも @fzn0x が今日担当しました。 オープンdocumentation
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信