问题
I need an embeddable audio player that will play wav files in IE, FF, and Chrome. Converting to mp3 (or any other format) is not an option at this time.
This player should be very simple with only a play/pause button and perhaps a timeline bar that a user could click to go to a specific part of the audio.
There also should be an easy way to have multiple instances of this audio player on a single page.
I've found information on solutions that range from very feature-rich (complex) to simple, but none seemed to provide what I need.
If this player comes with any sort of tutorial, that would be a bonus. I know I will probably have to create an <obj>
with an <embed>
inside of it to make this work in all three browsers.
The ideal solution is just a .swf file that I can put into my webapp source and can reference from the html.
Does a solution like this exist? Does flash even support .wav (raw)?
回答1:
I found something close to what I want here:
http://blog.datacompboy.ru/2010/01/27/wavplayer-1-7-1-full-js-api-and-support-for-reversed-order-bits-lu-and-la/#comments
It will play a wav file that is locally stored with the index.html and .swf. However, if I change the object parameters (and embed src) to something like
<param name="movie" value="wavplayer.swf?gui=full&h=20&w=300&sound=http://someserver/some/path/to/a/wavFile.wav"/>
It does not work. I couldn't find anything on the (Russian translated to English) site or in the README addressing loading a wav over http or if a link should work. Maybe someone familiar with flash development could read the code and see if this is possible?
EDIT:
It was suggested that a crossdomain.xml might be the issue. I added the following in the 'some' directory from the path above:
<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
However, I still was unable to play the wav file.
回答2:
Flash doesn't contain any native support for opening the .wav container at runtime, but if you're willing to roll up your sleeves a bit, it can be hacked in.
One method is outlined here: Flash swf to play PCM WAV files?
来源:https://stackoverflow.com/questions/4091812/html-embeddable-flash-wav-player