Author Topic: Cannot play audio recordings in browser(s)  (Read 18870 times)

WRP

  • Jr. Member
  • **
  • Posts: 57
  • Karma: 1
    • View Profile
Cannot play audio recordings in browser(s)
« on: March 23, 2012, 05:38:10 »
We are unable to play back audio recordings in our browsers. With Chrome and Safari, we simply get a non-clickable audio control or broken Quicktime logo. For Firefox, we can generally play the audio file, but it will be truncated.

We are able to download the files by right clicking and saving. We can even play the downloaded files by opening any one of these browsers.

From what I can tell, this is an issue with the download URL ending in .do, even though a .WAV file is returned. The browser sends headers for an html or xml document, but gets audio/wav in return. I've attached screenshots of the errors that Safari throws in its webkit development console. The error, specifically, is "Resource interpreted as Document but transferred with MIME type audio/wav."

How can we resolve this issue?






coolname

  • Full Member
  • ***
  • Posts: 163
  • Karma: 0
    • View Profile
Re: Cannot play audio recordings in browser(s)
« Reply #1 on: March 24, 2012, 16:13:15 »
i also have this problem

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Cannot play audio recordings in browser(s)
« Reply #2 on: March 30, 2012, 18:08:10 »
From what you post, the results seems correct. We had similar issues in the past with GSM files saved as WAV - the correct thing to do would be telling the browser not to attempt opening the file but sending it to an external program, e.g. VNC.

WRP

  • Jr. Member
  • **
  • Posts: 57
  • Karma: 1
    • View Profile
Re: Cannot play audio recordings in browser(s)
« Reply #3 on: March 30, 2012, 18:23:27 »
I have to disagree with you. Any link that leads to a file that can be opened by the browser, by default, should be opened by the browser. Clicking on a link that leads to an audio file should play the audio file in the web browser, unless the user specifies otherwise ("Save As", etc). The problem seems to lie in how you dispatch audio files to the browser.

I cannot tell customers "you'll need to save each audio file to your desktop before hearing it". Please patch this bug! :)


QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Cannot play audio recordings in browser(s)
« Reply #4 on: April 04, 2012, 15:38:44 »
It is important that you understand how this works - QM only streams back the file Asterisk wrote. So if Asterisk wrote a file with a format that a browser does not understand, there is no way to play it in a browser.

The correct thing to do - for me - would be to recode all audio files to MP3 on the Asterisk box, so that it is aforma that works with all browsers and it is very compact. See e.g. http://astrecipes.net/index.php?n=294

WRP

  • Jr. Member
  • **
  • Posts: 57
  • Karma: 1
    • View Profile
Re: Cannot play audio recordings in browser(s)
« Reply #5 on: April 10, 2012, 01:14:49 »
The browser is able to play back the audio files that Asterisk is recording. In my first post, I mention that I can "Save As" the audio file to the desktop and then open it with any browser. It plays back perfectly.

The problem lies in trying to open the audio file from the link provided in QueueMetrics, directly from QueueMetrics. Since QueueMetrics is forwarding us to a URL ending in ".do", the browser doesn't know what to expect, so it defaults to HTML. When audio/wav formatted data comes back instead, the browser fails to play it back because, as it states, "Resource interpreted as Document but transferred with MIME type audio/wav".

To summarize:
* Asterisk audio format is readable by the browser
* Tomcat is returning the resource with the right MIME type of audio/wav.
* The browser is refusing to play it because QueueMetrics is sending the browser to a ".do" file URL, which is not the correct extension for audio.

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Cannot play audio recordings in browser(s)
« Reply #6 on: April 11, 2012, 13:02:37 »
The MIME type should override any settings from the URL, so if that is correct, that should be it.

WRP

  • Jr. Member
  • **
  • Posts: 57
  • Karma: 1
    • View Profile
Re: Cannot play audio recordings in browser(s)
« Reply #7 on: April 11, 2012, 18:36:10 »
The MIME type should override any settings from the URL, so if that is correct, that should be it.

RFC 2616 states that a web request can include an "Accept" header which specifies the format of file that is required to be returned. Since the QM URL ends in ".do", every major web browser (IE, Firefox, Chrome, Safari) defaults to requesting "text/html, application/xml", etc. QM responds with "audio/wav".

In other words, MIME types in the response do not have the ability to override the request header data. URLs do not intrinsically have any settings.

Two problems here:

1) The URL ends in ".do", causing the browser to set a default "Accept" value. The URL should end in .wav, as this is a .wav resource.

2) QM is ignoring the Accept header. In this case, if anything, QM should return with a "406 Not Acceptable"


Resources:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html ( sec 14.1 )
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html ( sec 10.4.7 )

WRP

  • Jr. Member
  • **
  • Posts: 57
  • Karma: 1
    • View Profile
Re: Cannot play audio recordings in browser(s)
« Reply #8 on: May 08, 2012, 01:24:10 »
QueueMetrics: I'd appreciate a response to my previous post.

We are coming up on our license renewal. Yes, we'll likely renew either way, but it would be nice to get the feeling that your support department is taking care of us.

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Cannot play audio recordings in browser(s)
« Reply #9 on: May 09, 2012, 13:38:08 »
We are tracking this issue as #1631.
you mean that we should e.g. have a URL like http://server/action.do/audio.wav?

WRP

  • Jr. Member
  • **
  • Posts: 57
  • Karma: 1
    • View Profile
Re: Cannot play audio recordings in browser(s)
« Reply #10 on: May 09, 2012, 18:11:42 »
As I understand the spec, that would fix it.

jonstar

  • Newbie
  • *
  • Posts: 19
  • Karma: -1
    • View Profile
Re: Cannot play audio recordings in browser(s)
« Reply #11 on: August 05, 2012, 13:44:06 »
will QM pick up a .mp3 file that lives in the recordings directory ? I already do some tricky stuff for storage of files and converting to mp3 offline would be no problem... so long as QM would pick it up so that it could be listened to.

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Cannot play audio recordings in browser(s)
« Reply #12 on: August 06, 2012, 12:28:09 »
Yes Qm will handle it okay.