[Bug]: Accessing document.cookie after being patched by cookies plugin causes YouTube iframe player to pause playback
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 7.0.1 @capacitor/core: 7.0.1 @capacitor/android: 7.0.1 @capacitor/ios: 7.0.1
Installed Dependencies:
@capacitor/cli: 6.2.0 @capacitor/android: 6.2.0 @capacitor/core: 6.2.0 @capacitor/ios: 6.2.0
[success] iOS looking great! 👌
Other API Details
pnpm 9.15.3
node v20.18.1
pod 1.14.3
Platforms Affected
- [x] iOS
- [ ] Android
- [ ] Web
Current Behavior
I embedded a YouTube iframe player in my application. Whenever any code accesses document.cookie, it causes the player to pause automatically.
This issue currently only occurs in the Capacitor iOS environment when using the Capacitor cookie plugin.
Expected Behavior
Accessing document.cookie should not affect the state of the YouTube iframe player.
Project Reproduction
https://github.com/anson0370/yt-player-capacitor-issue
Additional Information
I've also opened the same issue with Google, and I'm not sure which side the problem is actually on.
https://issuetracker.google.com/issues/395212983
After further research and verification, I believe this issue is related to the code here:
https://github.com/ionic-team/capacitor/blob/90f95d1a829f3d87cb46af827b5bfaac319a9694/core/native-bridge.ts#L421
Capacitor uses window.prompt to transfer data. And YouTube iframe player pauses after the prompt is called. I don't know why the YouTube iframe player pauses after a prompt call, and whether this behavior is necessary.