bluefireteam / audioplayers

A Flutter package to play multiple audio files simultaneously (Android/iOS/web/Linux/Windows/macOS)
https://pub.dartlang.org/packages/audioplayers
MIT License
1.98k stars 843 forks source link

MacOS circular references cause some unexpected exceptions #1798

Open qzlong opened 4 months ago

qzlong commented 4 months ago

Checklist

Current bug behaviour

In the file SwiftAudioplayersDarwinPlugin.swift, the register method creates an instance of SwiftAudioplayersDarwinPlugin that holds the registrar, and the register method calls registrar.addMethodCallDelegate(instance, channel: methods) to register the instance with the registrar. Circular references have caused some anomalies. Perhaps it is possible to change the attribute definition from var register: FlutterPluginRegister to weak var register: FlutterPluginRegister?

image

Expected behaviour

-

Steps to reproduce

No response

Code sample

No response

Affected platforms

iOS, macOS

Platform details

No response

AudioPlayers Version

main

Build mode

No response

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

No response

Related issues / more information

No response

Working on PR

no way

Gustl22 commented 4 months ago

Good insight, thanks. Perhaps one can look at other platform implementations e.g. video_player and apply the best practice to the darwin implementation. We appreciate any help from the community!