Question

netryan on Tue, 03 Apr 2012 02:35:08


I have a strange problem which is that audio that I upload to my blob storage can't be played by the html5 audio element.  It CAN be downloaded just fine from there, is public, and can be played with silverlight.  But when I attempt to play the mp3 with an HTML5 audio tag, all I see is an X and nothing plays.  Also, I CAN play the exact same mp3 from someone's elses blob storage, but not mine.

So it looks like the problem is that audio clips that I upload to my BLOB storage can't be played with the html5 audio tag (although, like I said above, I can play mp3s from other people's BLOB storage).  I can play them with Silverlight though.  This is starting to drive me crazy.  Any ideas?   I've tried reuploading, different audio clips and formats, but still can't get the audio tag to work with my BLOB storage.



Sponsored



Replies

Steve Marx on Tue, 03 Apr 2012 03:28:03


Is the "Content-Type" set correctly on the blob?

freaky roach on Tue, 03 Apr 2012 11:17:44


You need to set content type as audio/mpeg3. If you are using any tool, such as azure storage explorer you can edit the content type property after upload.

Else if you are uploading from within code then set the metadata as below: 

                CloudBlobContainer container = blobClient.GetContainerReference(containerName);
                blob = container.GetBlobReference(blobName);
                
                var metadata = new NameValueCollection();
                metadata["Name"] = fileName;               

                blob.Properties.ContentType = "audio/mpeg3";

                // Add metadata to blob
                blob.Metadata.Add(metadata);
                blob.UploadByteArray(data);


If this post answers your question, please mark it as an answer. If this post is helpful to you, then vote it as helpful.
TechyFreak | Mobile Development Resources


netryan on Tue, 03 Apr 2012 11:41:46


Yes, that was the problem.  Thank you both very much!