how to get waveform data when I play music in .net ios?

mc 5,426 Reputation points
2024-12-19T00:25:12.72+00:00

in .net android there is Visualizer but in .net ios there is not.

and I searched that there is InstallTapOnBus and how to get the data when it is playing?

Developer technologies .NET .NET MAUI
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2024-12-20T06:02:48.1566667+00:00

    Hello,

    now I have not find the AVPlayerNode

    Please try using AVAudioEngine to play the audio, then fine the AVPlayerNode by visiting the MainMixerNode property. For example, I create a custom player class.

      public class AudioPlayer
      {
          public AVAudioEngine Engine { get; set; } = new AVAudioEngine();
          public AVAudioPlayerNode Player { get; set; }= new AVAudioPlayerNode();
          public AudioPlayer()
          {
              Engine.AttachNode(Player);
              Engine.Connect(Player,Engine.MainMixerNode,null);
              Engine.MainMixerNode.InstallTapOnBus(0, 2048, null, (buffer, when) => {
              });
              Engine.Prepare();
            //  NSError e = new NSError();
           //   Engine.StartAndReturnError(out e);
     
          }         
      }
    

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.