Xamarin XCT Media Element not playing recorded audio on Android

SSB 111 Reputation points
2022-07-24T17:08:49.087+00:00

I am using the Plugin.AudioRecorder to record audio and then save it / play it back using the XCT Media element control.

Working fine on iPhone, however on Android it's not playing back the audio at all - either locally or from a URL.

I've taken a copy of the Xamarin sample project (https://github.com/xamarin/xamarin-forms-samples/tree/main/UserInterface/MediaElementDemos) and replaced the URL in the PlayWebAudioPage with the link to my recorded Audio file and it just doesn't play on Android.

Any ideas on how to investigate this further / fix?

The file plays fine on iPhone, on the computer web browser, VLC etc.

Developer technologies | .NET | Xamarin
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-07-26T02:44:01.45+00:00

    Hello,​

    Do you know if it is possible to get the total duration of the audio file via Media Manager?

    You can use mediaItem.Duration to get the total duration of the audio file via Media Manager like following code.

       var mediaItem = await CrossMediaManager.Current.Play("https://ia800806.us.archive.org/15/items/Mp3Playlist_555/AaronNeville-CrazyLove.mp3");  
        var duration= mediaItem.Duration;  
    

    Best Regards,

    Leon Lu


    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.


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.