How to play audio file ?

1 Answer 378 Views
Upload
shashank
Top achievements
Rank 1
Iron
shashank asked on 14 Jul 2023, 09:22 PM | edited on 14 Jul 2023, 09:22 PM
I have uploaded .wav audio file using kendo upload and i have the blob path and url, that the file is saved to.
Now do we have a control that helps us play audio file that is uploaded. like we have this
https://demos.telerik.com/aspnet-core/mediaplayer/events

1 Answer, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 19 Jul 2023, 03:44 PM

Hello Shashank,

I have tested the MediaPlayer Component and it supports playback of both .mp3 and .wav audio files.

However, since the Component is designed primarily for video it still may not present the ideal visuals for audio playback.

If you'd like to see the functionality of the MediaPlayer expand I recommend voting for the existing Feature Request here. Also consider writing a comment there as to what kind of changes you'd like to see or alternatively submit a new Feature Request in the portal. This is important to us as we determine what features to implement in the future based on community interest.

Finally, as an alternative you may also find useful the built in Html audio element.

I hope the information above is insightful.

Regards,
Stoyan
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
shashank
Top achievements
Rank 1
Iron
commented on 19 Jul 2023, 03:48 PM

I dont want to play them as a list, I have those files saved on blob and I get the bytedata that we have for download and using that data I want the kendo media player to fetch that blob url or bytedata and play it
Stoyan
Telerik team
commented on 24 Jul 2023, 01:51 PM

Hello Shashank,

If you are fetching media files from the server during execution you can set them as the source of the MediaPlayer in the following way:

   $(document).ready(function(){
        var mediaplayer = $("#mediaPlayer").data("kendoMediaPlayer");
        var url = "@Url.Content("~/sources/my_sound.wav ")";
        fetch(url).then(function (response) {
            if (response.ok) {
                return response.blob();
            }  
        }).then(function (blob) {
            mediaplayer.media({title:"my_sound",source:URL.createObjectURL(blob)})
        })
    })

For your convenience I am attaching a sample project that showcases the above as well as the MediaPlayer used to only play audio.

Please review the behavior of the example and let me know whether any further questions on the topic arise.

Tags
Upload
Asked by
shashank
Top achievements
Rank 1
Iron
Answers by
Stoyan
Telerik team
Share this question
or