This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

This API is available on Firefox or Firefox OS for installed or higher privileged applications.


The WebFM API provides access to the device FM radio. This interface lets you turn the FM radio on and off and tune it to different stations. It is accessible through the navigator.mozFMRadio property.

API Overview

interface FMRadio : EventTarget {
   readonly attribute boolean enabled;
   readonly attribute boolean antennaAvailable;
   readonly attribute double frequency;
   readonly attribute double frequencyUpperBound;
   readonly attribute double frequencyLowerBound;
   readonly attribute double channelWidth;

   attribute Function onantennaavailablechange;
   attribute Function onfrequencychange;
   attribute Function onenabled;
   attribute Function ondisabled;

   DOMRequest enable(double frequency);
   DOMRequest disable();
   DOMRequest setFrequency(double frequency);
   DOMRequest seekUp();
   DOMRequest seekDown();
   DOMRequest cancelSeek();


Indicates whether the radio is playing
Indicate if an antenna is plugged and available
Current radio frequency.
Maximum frequency up to which the seek method searches for radio stations
Minimum frequency down to which the seek method searches for radio stations
The channel width of the ranges of frequency, in MHz.

Event handlers

A handler for the enabled event; It is triggered when the radio has been turned on
A handler for the disabled event; It is triggered when the radio has been turned off
A handler for the antennaavailablechange event; It is triggered when an antenna is plugged or unplugged
A handler for the frequencychange event; It is triggered whenever the radio frequency is changed


Turns on the radio on the given frequency. This function throws if called with no argument. Returns a DOMRequest for the success or error of the operation.
Turns the radio off. Returns a DOMRequest which success indicates that the radio has properly been disabled
Asynchronously changes the radio frequency. The value has to be between frequencyLowerBound and frequencyUpperBound. Trying to set outside the bounds results in an error.
Returns a DOMRequest which success indicates the frequency has properly been changed.
Asks the radio to find a new frequency (usually greater than the current one). If one is successfully found, a frequencychange event is fired. Returns a DOMRequest which success indicates that the search has started. The search circles back to lower frequencies when the highest frequency has been reached.
Same as above, but searching in frequencies lower than the current one. The search cirlces back to higher frequencies when the lowest frequency has been reached.
Cancels the radio seek if one was happening. Returns a DOMRequest which success indicates that the frequency search has been cancelled.


Not part of any specification.

See also

Document Tags and Contributors

 Last updated by: Jeremie,