Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Cross-Platform-Entwicklung (https://www.delphipraxis.net/91-cross-platform-entwicklung/)
-   -   Audio-Session-Initialisierung für iOS (https://www.delphipraxis.net/211680-audio-session-initialisierung-fuer-ios.html)

philipp.hofmann 21. Okt 2022 13:58

Audio-Session-Initialisierung für iOS
 
Hi,

ich muss für einen Test mit einer Video-Chat-Software folgendes Settings vornehmen:
"Was Sie versuchen können, wäre, falls noch nicht gemacht, die AVAudioSession auf Mode AVAudioSession.Mode.videoChat einzustellen und die AVAudioSession.CategoryOption.mixWithOthers hinzuzufügen."

Grund ist, dass aktuell sobald ich den Video-Chat-Raum betrete, die in der App abgespielte Musik aufhört zu spielen.
Jetzt habe ich dies mit folgendem Code versucht:

Delphi-Quellcode:
procedure TicTrainerF.initIOSAudioSession();
var AudioSession: AVAudioSession;
    LErrorPtr: Pointer;
    LError: NSError;
    hasError: boolean;
begin
  mlog.info('initIOSAudioSession');
  hasError:=false;
  LErrorPtr := nil;
  AudioSession := TAVAudioSession.Wrap(TAVAudioSession.OCClass.sharedInstance);
  if (not hasError) then
  begin
    AudioSession.setMode(CocoaNSStringConst(libAVFoundation, 'AVAudioSessionModeVideoChat'),@LErrorPtr);
    if (LErrorPtr <> nil) then
    begin
      LError := TNSError.Wrap(LErrorPtr);
      mlog.info('initIOSAudioSession-Error (setMode): '+NSStrToStr(LError.localizedDescription));
      hasError:=true;
    end;
  end;
  if (not hasError) then
  begin
    AudioSession.setCategory(CocoaNSStringConst(libAVFoundation, 'AVAudioSessionCategoryOptionMixWithOthers'),@LErrorPtr);
    if (LErrorPtr <> nil) then
    begin
      LError := TNSError.Wrap(LErrorPtr);
      mlog.info('initIOSAudioSession-Error (setCategory): '+NSStrToStr(LError.localizedDescription));
      hasError:=true;
    end;
  end;
  if (not hasError) then
    mlog.info('initIOSAudioSession: finished successfully');
end;
Ich bekomme bei den Aufrufen aber einen OSStatus-Fehler -50 Fehler zurück.
Was ist hier noch falsch?

Grüße, Philipp


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:53 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz