Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
I have an HTML5 audio control in MVC. i am playing wav file in that control. In Chrome working fine but in Internet Explorer and Safari not working. I am fetching audio from s3 buckets
So, Please give me the solution

What I have tried:

var audioElementGrid = document.createElement('audio');


$("#profileGrid").on("click", ".btn-play", function () {
           audioElementGrid.setAttribute('src', $(this).attr("data-url"));
           audioElementGrid.pause();
           audioElementGrid.play();
           $("a.btn-play").html("">");
           $(".lightbox-playBtn").addClass("lightbox-stopBtn");

           audioElementGrid.addEventListener('ended', function () {
               $("a.btn-play").html("^__i class="fa fa-play-circle-o fa-2">");
               $('.lightbox-playBtn').removeClass("lightbox-stopBtn");
               $(".audio-btn").addClass("btn-play");
               $(".audio-btn").removeClass("btn-stop");
           }, false);
       });



public FileResult GetAudio(string key)
        {
            Stream file = new MemoryStream();
            try
            {
                GetObjectResponse r = s3Client.GetObject(new GetObjectRequest()
                {
                    BucketName = bucketName,
                    Key = key
                });
                try
                {
                    return File(r.ResponseStream, "audio/wav");  
                }
                finally
                {
                }              
            }
            catch (AmazonS3Exception)
            {
                //Show exception
            }
            return null;
        }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900