I need to play an mp3 file; something like
var sound = new Audio('http://.......');
snd.play();
does work in Chrome and Firefox on Windows but not in Firefox on Mac, can you confirm it is the normal behaviour?
From here:
https://bugzilla.mozilla.org/show_bug.cgi?id=799318
it seems that on Mac the feature has been just added (so probably the current release of Firefox doesn't provide it) but there are a lot of messages about and I'm a bit confused...
Is it normal that if I just put the mp3 URL in the URL bar it works?
So if you confirm that it is the normal behaviour can you tell me which are the alternatives?
1) flash fallback ?
2) convert mp3 to oog (supported by firefox) on the fly?
Can you explain how to implement both?
Thanks.
Yes that is the normal behavior. See here: https://bugzilla.mozilla.org/show_bug.cgi?id=851290
A Flash fallback would probably be easier. I'd recommend using SoundManager2 as it will provide you with a uniform API without having to worry about which codecs the browser supports.
Look into this. https://github.com/nddrylliog/jsmad#readme
It coverts it on the fly.
You can use a wrapper around the URLs you use to play audio, since different browsers support different codecs. The audio object has a canPlayType method which you can use (with understandably more verbose codec names unfortunately) to determine what type is supported by a browser. With this, you can make a function that takes a URL path and modifies the extension.
// If you wanted to provide only ogg and mp3:
function getSoundURL (url) {
var audio = document.createElement('audio');
if (!audio.canPlayType) return null;
if (audio.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/, ''))
return url + '.ogg';
if (audio.canPlayType('audio/mpeg;').replace(/no/, ''))
return url + '.ogg';
return null;
}
More info on canPlayType and codecs.
There are also some tools to easily detect what types are supported, one being allen which I use frequently for audio projects. disclaimer: I made it :p
Flash alternatives would work (SoundManager2 mentioned above is good), and transcoding on the server is possible, with something like FFMPEG, depending on your server.
Related
Right now I'm using the latest ABC PDF version, and use the Gecko rendering engine. However, I notice that there are small differences between the way Firefox renders the HTML I'm adding to my PDF, and the way ABC PDF interprets the HTML. I was wondering if there is anything that can be done against this?
I'm asking about Firefox specifically because I thought that browser used the same Gecko rendering engine as ABCPDF did, so I thought it would be 100% the same.
Does anyone know about this? Couldn't find much about this on the internet, though I do admit that I find it hard to come up with the correct search terms.
By default ABCpdf will use the 'print' css media type whereas Firefox will be using 'screen', this can be changed by setting the media property.
var doc = new Doc()
doc.HtmlOptions.Media = MediaType.Screen
If the differences are more subtle it may be worth taking a look at engine configuration.
It is important to note the Gecko engine used in ABCpdf is independent from the engine used in any local Firefox installation, it should be assumed that it will be different in both version and configuration.
So I've read other posts and the supposed fixes for IE8 but none have seemed to work. The main player on the MediaElementjs.com site doesn't even work in IE8.
Can anyone point me to a site that they know uses mediaelement.js successfully in IE8?
The plan being to view source and repeat what they've done.
Thanks!
My site seems to work in IE8, here is a page with a video: http://www.theguitarlesson.com/guitar-lessons/white-christmas-guitar-lesson-bing-crosby/
I had to set enablePluginSmoothing to true as describe here, since the Flash playback quality was baaaaad out of the box, but didn't do anything else. That I found here: Video quality issues with MediaElement.JS and Flash
I found that I had to put the
<script>$('audio').mediaelementplayer();</script>
last in the body element for it to work in IE8 and other old IE versions. I'd put it in the head, since the instructions say the link to the script has to be in the head if you want to support old versions of IE so I assumed the call would have to go there too.
If you've copied the object tags from the full video example (Option B on the site) then IE will load the Flash player but won't add the mediaelement.js markup that's needed to load the media.
The best example to work from for audio is the demo/mediaelementplayer-audio.html page in the zipped download in the latest version (you'll need to download the media as well, not sure why that's separate but it's here: https://github.com/johndyer/mediaelement-files/ ). Copy the pieces of it into your page, in the same places, then replace with your own file paths. If that doesn't work, then the problem is likely with your MIME type or CSS visibility properties.
Issue calls after $(document).ready, or when media element has loaded.
I'm working with an existing ActiveX control, we have a NPAPI for it, and it works well for the most part in FireFox.
It supports viewing image types, one type, TIFF works well but for some reason JPG doesn't.
So I simplified MIMEType in my .rc file to be simply "image/tiff". That works well, I can drag a *.tif file into FireFox and the plugin loads.
However when I my MIMEType is defined as simply "image/jpeg", it doesn't work for *.jpg files and FF just natively displays the JPG instead of letting my plugin do it. I tried "image/jpe" and that works for *.jpe files. I also tried "image/jpg", but no luck. Is JPG a special case for NPAPI?
Additionally, I can get my plugin to load for *.jp2 files when I specify "image/jp2". I don't seem to have any other plugin installed that would be loading the JPG instead. In fact, plugin-container.exe doesn't even load when FireFox displays the JPG so that makes me think it has something to do with FF's native display overriding my plugin.
For supported (built-in) image types, plugins are not considered (i don't think any browser does that).
TIFF is not a supported image type for Firefox, hence plugins are used if they handle that mimetype/extension.
Note: When handling image mimetypes you are prone to colliding with other plugins (Quicktime specifically) - there are no real guarantees on which plugin will be used if more than one supports a specific mimetype or extension.
It wouldn't surprise me at all if Firefox is overriding your plugin; the last thing they want is for a plugin to be able to take over viewing basic filetypes. I'm kinda surprised overriding tiff worked, to be honest.
The mimetype settings look like this:
mimetypes: ['audio/*'],
Firefox on windows 7 cannot upload mp3 files, other browsers work fine. They get the "not audio file" error.
Is this a bug with filepicker?
Most likely this is an issue with the way that firefox is reporting the mimetypes of mp3 files - I'd recommend trying filtering by extension instead. There are times when mimetypes are more appropriate and times where they break down due to differing implementations, which is why we provide both mechanisms.
Using shell_exec with Xvfb and FireFox currently to capture screen shots. However, need to download the entire html (e.g. Save Page As --> Web Page complete.) to a directory using shell_exec. Have looked at all the different option available in the Mozilla Developers Forums but have not been able to figure out how to do this.
This code appears to be what I might need but where and how is this implemented so it can be accessible in shell_exec?
var file = Components.classes["#mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("C:\\filename.html");
var wbp = Components.classes['#mozilla.org/embedding/browser/nsWebBrowserPersist;1']
.createInstance(Components.interfaces.nsIWebBrowserPersist);
wbp.saveDocument(content.document, file, null, null, null, null);
The Above Code Source
void saveDocument(
in nsIDOMDocument aDocument,
in nsISupports aFile,
in nsISupports aDataPath,
in string aOutputContentType,
in unsigned long aEncodingFlags,
in unsigned long aWrapColumn
);
The Above Code Source
There is a Stackoverflow manual solution here but it does not address shell_exec:
How to save a webpage locally including pictures,etc
There are few options that I know of, but none that I know are fitting your question exactly..
Open firefox http://yoursite.com from shell, then send keystrokes to firefox using xte or similar method. (This is not headless mode though.)
Download using wget. It can work in recursive manner. Or alternately you can parse the HTML, if it is quite simple web page. If you need to submit form, use curl instead of wget.
Use greasemonkey addon & write a script, which would get loaded on http://some-fake-page.com/?download=http://yoursite.com & then open firefox with that fake-page url.
Develop your own firefox addon to do above work.
There may be other better options for this as well, but I don't know them.