The TV Manager API allows an application to manage the TV device.
This document is no longer maintained. Please refer to the link for the latest specification.

Introduction

The TV Manager API interfaces provide a bunch of properties and a set of operations to allow Web applications to acquire the information of TV sources, TV channels and TV programs as well as to manage the native TV hardwares (i.e., TV tuners) or the TV Web services.

User Cases

The TV Manager API is aimed to cover the following user cases:

Examples

If an application has the privilege to use the TV Manager API, it can use a bunch of basic methods defined in the TVManager to manage the TV device.

The following example shows how to get all the TV tuners that are currently available on the TV device and how to listen to the events for the TV tuner changes.

          // An array which saves all the currently available TV tuners.
          var curTuners = [];

          // Set the 'ontunerchanged' event handler.
          navigator.mozTV.ontunerchanged = function ontunerchanged(event) {
            var operation = event.operation;
            var changedTuner = event.tuner;

            switch (operation) {
              case "added":
                curTuners.push(changedTuner);
                break;
              case "removed":
                curTuners.some(function findTuner(tuner, index) {
                  if (tuner.id == changedTuner.id) {
                    curTuners.splice(index, 1);
                    return true;
                  }
                  return false;
                });
                break;
              default:
                break;
            }
          };

          // Retrieve all the currently available TV tuners.
          navigator.mozTV.getTuners().then(function onsuccess(tuners) {
            curTuners = tuners;

            tuners.forEach(function setEventHandler(tuner) {
              // Set the 'oncurrentsourcechanged' event handler.
              tuner.oncurrentsourcechanged = function oncurrentsourcechanged(event) {
                alert("The current TV source of TV tuner: " + tuner.id +
                      " is configured to: " + event.source.type);
              };
            });
          }, function onerror(error) {
            alert(error);
          });
        

The following example shows how to get all the TV channels that are currently available in the currently configured TV source of a TV tuner and how to listen to the events for the TV channel changes.

          // A matrix which maps the TV tuner to its corresponding array of TV
          // channels based on the currently configured TV source.
          // E.g., { "tunerId1": [...], "tunerId2": [...] }.
          var curChannelsOfTuners = {};

          // Retrieve all the currently available TV tuners in the TV device.
          navigator.mozTV.getTuners().then(function onsuccess(tuners) {
            tuners.forEach(function getChannelsByTuner(tuner) {
              var tunerId = tuner.id;
              var currentSource = tuner.currentSource;

              if (!currentSource) {
                return;
              }

              // Set the 'onscanningstatechanged' event handler.
              currentSource.onscanningstatechanged = function onscanningstatechanged(event) {
                var state = event.state;
                var scannedChannel = event.channel;

                switch (state) {
                  case "cleared":
                    if (curChannelsOfTuners[tunerId]) {
                      delete curChannelsOfTuners[tunerId];
                    }
                    break;
                  case "scanned":
                    var channels = curChannelsOfTuners[tunerId];
                    if (channels) {
                      channels.push(scannedChannel);
                    } else {
                      curChannelsOfTuners[tunerId] = [scannedChannel];
                    }
                    break;
                  default:
                    break;
                }
              };

              // Retrieve all the currently available TV channels in the
              // currently configured TV source of the TV tuner.
              currentSource.getChannels().then(function onsuccess(channels) {
                curChannelsOfTuners[tunerId] = channels;

                channels.forEach(function setEventHandler(channel) {
                  // Set the 'onprotectionstatechanged' event handler.
                  channel.onprotectionstatechanged = function onprotectionstatechanged(event) {
                    alert("The current protection state of TV channel: " + channel.name +
                          " is configured to: " + event.isProtected);
                  };
                });
              }, function onerror(error) {
                alert(error);
              });
            });
          }, function onerror(error) {
            alert(error);
          });
        

The following example shows how to get all the TV programs that are currently available in the TV channel and how to listen to the events for the TV program changes.

          // A matrix which maps the TV channel to its corresponding array of TV
          // programs. E.g., { "channelNumber1": [...], "channelNumber2": [...] }.
          var curProgramsOfChannels = {};

          // Retrieve all the currently available TV tuners in the TV device.
          navigator.mozTV.getTuners().then(function onsuccess(tuners) {
            if (tuners.length == 0) {
              return;
            }

            // Just use the first TV tuner.
            var tuner = tuners[0];
            var currentSource = tuner.currentSource;

            if (!currentSource) {
              return;
            }

            // Set the 'oneitbroadcasted' event handler.
            currentSource.oneitbroadcasted = function oneitbroadcasted(event) {
              var newPrograms = event.programs;

              // Flush the EPG because a new EIT is broadcasted by the TV source.
              curProgramsOfChannels = {};

              newPrograms.forEach(function addProgram(program) {
                var channelNumber = program.channel.number;

                var programs = curProgramsOfChannels[channelNumber];
                if (programs) {
                  programs.push(program);
                } else {
                  curProgramsOfChannels[channelNumber] = [program];
                }
              });
            };

            // Retrieve all the currently available TV channels in the currently
            // configured TV source of the TV tuner.
            currentSource.getChannels().then(function onsuccess(channels) {
              channels.forEach(function getProgramsByChannel(channel) {
                var channelNumber = channel.number;

                // Retrieve all the currently available TV programs in the TV
                // channel.
                channel.getPrograms().then(function onsuccess(programs) {
                  curProgramsOfChannels[channelNumber] = programs;
                }, function onerror(error) {
                  alert(error);
                });
              });
            }, function onerror(error) {
              alert(error);
            });
          });
        

The following example shows how to play the MediaStream of a TV source by assigning the MediaStream to a HTMLMediaElement.

          <!DOCTYPE html>
          <html>
            <head>
              <script>
                // Retrieve all the currently available TV tuners first.
                navigator.mozTV.getTuners().then(function onsuccess(tuners) {
                  if (tuners.length == 0) {
                    return;
                  }

                  // Just use the first TV tuner.
                  var tuner = tuners[0];

                  var video = document.getElementById("video-player");
                  video.srcObject = tuner.stream;
                }, function onerror(error) {
                  alert(error);
                });
              </script>
            </head>
            <body>
              <p><video id="video-player" autoplay></video></p>
            </body>
          </html>
        

The following example shows how to scan and get all the TV channels that are available in the currently configured TV source of the TV tuner.

          // Retrieve all the currently available TV tuners in the TV device.
          navigator.mozTV.getTuners().then(function onsuccess(tuners) {
            if (tuners.length == 0) {
              return;
            }

            // Just use the first TV tuner.
            var tuner = tuners[0];
            var currentSource = tuner.currentSource;

            if (!currentSource) {
              return;
            }

            // Set the 'onscanningstatechanged' event handler.
            currentSource.onscanningstatechanged = function onscanningstatechanged(event) {
              var state = event.state;
              var scannedChannel = event.channel;

              switch (state) {
                case "cleared":
                  alert("All the TV channels are cleared for rescanning.");
                  break;
                case "scanned":
                  alert("A new TV channel is scanned: " + scannedChannel.name);
                  break;
                case "completed":
                  alert("The scanning process is completed.");
                  break;
                case "stopped":
                  alert("The scanning process is stopped.");
                  break;
                default:
                  break;
              }
            };

            if (currentSource.isScanning) {
              return;
            }

            // Ask the currently configured TV source to scan the TV channels.
            currentSource.startScanning({
              isRescanned: true
            }).then(function onsuccess() {
              // Retrieve all the currently available TV channels in the
              // currently configured TV source of the TV tuner.
              currentSource.getChannels().then(function onsuccess(channels) {
                alert("Succeeded to scan and get all the TV channels.");
              }, function onerror(error) {
                alert(error);
              });
            }, function onerror(error) {
              alert(error);
            });
          });
        

The following example shows how to tune the TV channel by the TV channel number.

          // Retrieve all the currently available TV tuners.
          navigator.mozTV.getTuners().then(function onsuccess(tuners) {
            if (tuners.length == 0) {
              return;
            }

            // Just use the first TV tuner.
            var tuner = tuners[0];
            var currentSource = tuner.currentSource;

            if (!currentSource) {
              return;
            }

            // Retrieve all the currently available TV channels in the currently
            // configured TV source of the TV tuner.
            currentSource.getChannels().then(function onsuccess(channels) {
              if (channels.length == 0) {
                return;
              }

              // Just use the first TV channel.
              var channel = channels[0];
              var channelNumber = channel.number.

              // Tune the currently streamed TV channel based on the TV channel
              // number.
              currentSource.setCurrentChannel(channelNumber).then(function onsuccess() {
                alert("Succeeded to tune the currently streamed TV channel.");
              }, function onerror(error) {
                alert(error);
              });
            }, function onerror(error) {
              alert(error);
            });
          }, function onerror(error) {
            alert(error);
          });
        

The following example shows how to unlock the TV parental control.

          // Retrieve all the currently available TV tuners.
          navigator.mozTV.getTuners().then(function onsuccess(tuners) {
            if (tuners.length == 0) {
              return;
            }

            // Just use the first TV tuner.
            var tuner = tuners[0];
            var currentSource = tuner.currentSource;

            if (!currentSource) {
              return;
            }

            // This event handler will be triggered when the TV channel is tuned.
            currentSource.oncurrentchannelchanged = function oncurrentchannelchanged(event) {
              var changedCurrentChannel = event.channel;

              if (navigator.mozTV.isParentalControlLocked &&
                  changedCurrentChannel.isProtected) {
                // If the TV parental control is locked and the currently tuned
                // TV channel is protected, the |tuner.stream|'s media tracks
                // will be disabled (i.e. black screen). The UA can then pop up
                // a prompt to ask the user to enter the password to unlock it.
                alert("Parental control is locked. Please enter the password.");

                // Unlock the TV parental control which will be applied system-wisely.
                navigator.mozTV.unlockParentalControl().then(function onsuccess() {
                  alert("Parental control is unlocked until the next reboot.");
                }, function onerror(error) {
                  alert(error);
                });
              }
            };

            // Retrieve all the currently available TV channels in the currently
            // configured TV source of the TV tuner.
            currentSource.getChannels().then(function onsuccess(channels) {
              if (channels.length == 0) {
                return;
              }

              // Just use the first TV channel.
              var channel = channels[0];
              var channelNumber = channel.number;

              // Tune the currently streamed TV channel based on the TV channel
              // number.
              currentSource.setCurrentChannel(channelNumber).then(function onsuccess() {
                alert("Succeeded to tune the currently streamed TV channel.");
              }, function onerror(error) {
                alert(error);
              });
            }, function onerror(error) {
              alert(error);
            });
          }, function onerror(error) {
            alert(error);
          });
        

This specification defines conformance criteria that apply to a single product: the user agent that implements the interfaces that it contains.

Implementations that use ECMAScript to implement the APIs defined in this specification MUST implement them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification [[!WEBIDL]], as this specification uses that specification and terminology.

Terminology

The EventHandler interface represents a callback used for event handlers as defined in [[!HTML5]].

The concepts queue a task and fire an event are defined in [[!HTML5]].

The terms event handler and event handler event types are defined in [[!HTML5]].

The Promise interface, the concepts of a resolver, a resolver's fulfill algorithm and a resolver's reject algorithm are defined in [[DOM4]].

Navigator Interface

readonly attribute TVManager mozTV
MUST return the object that exposes the interface to the TV service.

TVManager Interface

The TVManager interface represents a bunch of properties and a set of operations that can be used to manage the TV device.

Promise getTuners ()
This method makes a request to retrieve all the TV tuners that are available in the TV device. It returns a new Promise that will be used to notify the caller about the result of the operation, which is an array of TVTuner elements.
Promise unlockParentalControl ()
This method makes a request to unlock the TV parental control by popping up a prompt to ask the user to input the correct password. Once the TV parental control is unlocked, it won't be locked until the next reboot. It returns a new Promise that will be used to notify the caller about the result of the operation.
readonly attribute boolean isParentalControlLocked
MUST return the current lock state of the TV parental control, which is system-widely applied to the TV device (i.e., once the parental control is unlocked, all the protected TV channels/programs will be unlocked until the next reboot).
attribute EventHandler onparentalcontrolchanged
Handles the onparentalcontrolchanged event of type TVParentalControlChangedEvent, fired when the method unlockParentalControl is invoked to unlock the TV parental control.
attribute EventHandler ontunerchanged
Handles the ontunerchanged event of type TVTunerChangedEvent, fired when the TV device detects a TV tuner is added/removed.

Steps

The getTuners method when invoked MUST run the following steps:

  1. Let promise be a new Promise object and resolver be its associated resolver.
  2. Return promise to the caller.
  3. Make a request to the TV device to retrieve all the TV tuners that are available in the TV device.
  4. If an error occurs invoke resolver's reject algorithm with error as the value argument.
  5. When the request has been successfully completed:
    1. Let tuners be the array of the retrieved TVTuner elements.
    2. Invoke resolver's fulfill algorithm with tuners as the value argument.

The unlockParentalControl method when invoked MUST run the following steps:

  1. Let promise be a new Promise object and resolver be its associated resolver.
  2. Return promise to the caller.
  3. Make a request to the TV device to unlock the TV parental control. The user agent has to pop up a prompt to ask the user to input the password to unlock the TV parental control.
  4. If an error occurs invoke resolver's reject algorithm with error as the value argument.
  5. When the request has been successfully completed:
    1. Invoke resolver's fulfill algorithm without assigning a value to the value argument.

Event handlers

The following are the event handlers (and their corresponding event types) that MUST be supported as attributes by the TVManager object.

Event handler Event name Event type Short description
ontunerchanged tunerchanged TVTunerChangedEvent Handles the information of the TV tuner that is added/removed by the TV device.
onparentalcontrolchanged parentalcontrolchanged TVParentalControlChangedEvent Handles the information of the changed state of the TV parental control.

TVTuner Interface

The TVTuner interface represents a bunch of properties and a set of operations related to the TV tuner.

Promise getSources ()
This method makes a request to retrieve all the TV sources that are available in the TV tuner. It returns a new Promise that will be used to notify the caller about the result of the operation, which is an array of TVSource elements that belong to the TV tuner.
Promise setCurrentSource ()
This method makes a request to configure the current TV source of the TV tuner by the sourceType parameter. It returns a new Promise that will be used to notify the caller about the result of the operation.
TVSourceType sourceType
Specifies the TV source type for configuring the current TV source.
readonly attribute DOMString id
MUST return the ID of the TV tuner.
readonly attribute TVSourceType[] supportedSourceTypes
MUST return the types of the supported TV sources.
readonly attribute TVSource? currentSource
MUST return the currently configured TV source. MUST return null if the TV source is not configured.
readonly attribute MediaStream? stream
MUST return a MediaStream object that is currently streamed by the TV tuner, which can be played by the video element by assigning the MediaStream to the HTMLMediaElement (details) and can be recorded by the MediaRecorder. MUST return null if the TV tuner is not streaming any data, which happens when the streaming signal is broken or due to any other reasons that the TV tuner fails to stream the data.
attribute EventHandler oncurrentsourcechanged
Handles the oncurrentsourcechanged event of type TVCurrentSourceChangedEvent, fired when the method setCurrentSource is invoked to configure the current TV source.

Steps

The getSources method when invoked MUST run the following steps:

  1. Let promise be a new Promise object and resolver be its associated resolver.
  2. Return promise to the caller.
  3. Make a request to the TV tuner to retrieve all the TV sources that are available in the TV tuner.
  4. If an error occurs invoke resolver's reject algorithm with error as the value argument.
  5. When the request has been successfully completed:
    1. Let sources be the array of the retrieved TVSource elements.
    2. Invoke resolver's fulfill algorithm with channels as the value argument.

The setCurrentSource method when invoked MUST run the following steps:

  1. Let promise be a new Promise object and resolver be its associated resolver.
  2. Return promise to the caller.
  3. Make a request to the TV tuner to configure the current TV source according to the sourceType parameter.
  4. If an error occurs invoke resolver's reject algorithm with error as the value argument.
  5. When the request has been successfully completed:
    1. Invoke resolver's fulfill algorithm without assigning a value to the value argument.

Event handlers

The following are the event handlers (and their corresponding event types) that MUST be supported as attributes by the TVTuner object.

Event handler Event name Event type Short description
oncurrentsourcechanged currentsourcechanged TVCurrentSourceChangedEvent Handles the information of the current TV source that is configured by the method setCurrentSource.

TVSource Interface

The TVSource interface represents a bunch of properties and a set of operations related to the TV source.

Promise getChannels ()
This method makes a request to retrieve all the TV channels that are available in the TV source. It returns a new Promise that will be used to notify the caller about the result of the operation, which is an array of TVChannel elements that belong to the TV source.
Promise setCurrentChannel ()
This method makes a request to tune the currently streamed TV channel by the channelNumber parameter. It returns a new Promise that will be used to notify the caller about the result of the operation.
DOMString channelNumber
Specifies the TV channel number for tuning the currently streamed TV channel.
Promise startScanning ()
This method makes a request to start scanning all the TV channels that are available in the TV source by the options parameter. It returns a new Promise that will be used to notify the caller about the result of the operation. Note that this method has to be called first so that the method getChannels can retrieve the channels that have successfully been scanned by the TV source.
optional TVStartScanningOptions options
Specifies the options for scanning the TV channels. The isRescanned option in the options parameter specifies whether or not the process of scanning the TV channels has to clear the currently scanned TV channels before scanning; if it is not passed, this method will rescan all the TV channels as if it is passed as true.
Promise stopScanning ()
This method makes a request to stop scanning the TV channels for the TV source. It returns a new Promise that will be used to notify the caller about the result of the operation.
readonly attribute TVTuner tuner
MUST return the TV tuner which the TV source belongs to.
readonly attribute TVSourceType type
MUST return the type of the TV source.
readonly attribute boolean isScanning
MUST indicate whether the TV source is scanning the TV channels or not.
readonly attribute TVChannel? currentChannel
MUST return the TV channel that is currently streamed by the TV tuner which owns the TV source. MUST return null if the TV tuner is not streaming any data.
attribute EventHandler oncurrentchannelchanged
Handles the oncurrentchannelchanged event of type TVCurrentChannelChangedEvent, fired when the method setCurrentChannel is invoked to tune the currently streamed TV channel.
attribute EventHandler oneitbroadcasted
Handles the oneitbroadcasted event of type TVEITBroadcastedEvent, fired when the Event Information Table (EIT) is broadcasted by the TV source.
attribute EventHandler onscanningstatechanged
Handles the onscanningstatechanged event of type TVScanningStateChangedEvent, fired when the state of scanning the TV channels is changed by the TV source. E.g., it can be fired when the method startScanning or the method stopScanning starts or stops scanning the TV channels.

Steps

The getChannels method when invoked MUST run the following steps:

  1. Let promise be a new Promise object and resolver be its associated resolver.
  2. Return promise to the caller.
  3. Make a request to the TV source to retrieve all the TV channels that are available in the TV source.
  4. If an error occurs invoke resolver's reject algorithm with error as the value argument.
  5. When the request has been successfully completed:
    1. Let channels be the array of the retrieved TVChannel elements.
    2. Invoke resolver's fulfill algorithm with channels as the value argument.

The setCurrentChannel method when invoked MUST run the following steps:

  1. Let promise be a new Promise object and resolver be its associated resolver.
  2. Return promise to the caller.
  3. Make a request to the TV source to tune the currently streamed TV channel according to the channelNumber parameter.
  4. If an error occurs invoke resolver's reject algorithm with error as the value argument.
  5. When the request has been successfully completed:
    1. Invoke resolver's fulfill algorithm without assigning a value to the value argument.

The startScanning method when invoked MUST run the following steps:

  1. Let promise be a new Promise object and resolver be its associated resolver.
  2. Return promise to the caller.
  3. Make a request to the TV source to start scanning all the TV channels that are available in the TV source according to the scanning options specified in the options parameter. If the isRescanned option in the options parameter is not passed or it is passed as true, the user agent has to clear the currently scanned TV channels before scanning; if it is passed as false, the user agent will simply scan additional TV channels which haven't been scanned yet.
  4. If an error occurs invoke resolver's reject algorithm with error as the value argument.
  5. When the request has been successfully completed:
    1. Invoke resolver's fulfill algorithm without assigning a value to the value argument.

The stopScanning method when invoked MUST run the following steps:

  1. Let promise be a new Promise object and resolver be its associated resolver.
  2. Return promise to the caller.
  3. Make a request to the TV source to stop scanning the TV channels.
  4. If an error occurs invoke resolver's reject algorithm with error as the value argument.
  5. When the request has been successfully completed:
    1. Invoke resolver's fulfill algorithm without assigning a value to the value argument.

Event handlers

The following are the event handlers (and their corresponding event types) that MUST be supported as attributes by the TVSource object.

Event handler Event name Event type Short description
oncurrentchannelchanged currentchannelchanged TVCurrentChannelChangedEvent Handles the information of the currently streamed TV channel that is tuned by the method setCurrentChannel.
oneitbroadcasted eitbroadcasted TVEITBroadcastedEvent Handles the information of the available TV programs in the EIT that is broadcasted by the TV source.
onscanningstatechanged scanningstatechanged TVScanningStateChangedEvent Handles the information of the state of scanning the TV channels, which is changed by the TV source.

TVChannel Interface

The TVChannel interface represents a bunch of properties and a set of operations related to the TV channel.

Promise getPrograms ()
This method makes a request to retrieve all the TV programs that are available in the TV channel by the options parameter. It returns a new Promise that will be used to notify the caller about the result of the operation, which is an array of TVProgram elements that belong to the TV channel.
optional TVGetProgramsOptions options
Specifies the options for retrieving the TV programs. If this parameter is not passed, this method will retuen all the available TV programs.
Promise setProtectionState ()
This method makes a request to configure the current protection state of the TV channel by the isProtected parameter. It returns a new Promise that will be used to notify the caller about the result of the operation.
boolean isProtected
Specifies the new protection state for configuring the current protection state of the TV channel.
readonly attribute DOMString networkId
MUST return the identification of a broadcast transmission network. On satellite and IP broadband, typically one networkId corresponds to an operator. On cable and terrestrial, where different radio frequencies might be used in different regions, operators typically use one networkId per such region.
readonly attribute DOMString transportStreamId
MUST return the identification of a time-domain multiplex of several programmes carried in Transport Stream (TS) packets. One or more multiplexes can be transmitted on any given radio frequency in a DVB network.
readonly attribute DOMString serviceId
MUST return the identification of a TV, radio or data programme within a TS multiplex. The number of programmes is limited by the capacity of the underlying physical channel.
readonly attribute TVSource source
MUST return the TV source which the TV channel belongs to.
readonly attribute TVChannelType type
MUST return the type of the TV channel.
readonly attribute DOMString name
MUST return the name of the TV channel. E.g., "CNN", "NHK"... etc.
readonly attribute DOMString number
MUST return the Logical Channel Number (LCN) of the TV channel. E.g., "12-1", "12-2", "12-2"... etc.
readonly attribute boolean isProtected
MUST return the current protection state of the TV channel, which decides whether or not the TV channel is protected from being watched by the children.
readonly attribute boolean isEmergency
MUST indicate whether the TV channel is for the emergency purpose.
readonly attribute boolean isFree
MUST indicate whether the TV channel is free to watch.
readonly attribute TVProgram? currentProgram
MUST return the TV program that is currently broadcasted by the TV channel. MUST return null if the TV tuner is not streaming any data.
attribute EventHandler oncurrentprogramchanged
Handles the oncurrentprogramchanged event of type TVCurrentProgramChangedEvent, fired when the currently broadcasted TV program is changed by the TV channel.
attribute EventHandler onprotectionstatechanged
Handles the onprotectionstatechanged event of type TVProtectionStateChangedEvent, fired when the method setProtectionState is invoked to configure the current protection state of the TV channel.

Steps

The getPrograms method when invoked MUST run the following steps:

  1. Let promise be a new Promise object and resolver be its associated resolver.
  2. Return promise to the caller.
  3. Make a request to the TV channel to retrieve all the TV programs that are available in the TV channel according to the retrieving options specified in the options parameter.
  4. If an error occurs invoke resolver's reject algorithm with error as the value argument.
  5. When the request has been successfully completed:
    1. Let programs be the array of the retrieved TVProgram elements.
    2. Invoke resolver's fulfill algorithm with programs as the value argument.

The setProtectionState method when invoked MUST run the following steps:

  1. Let promise be a new Promise object and resolver be its associated resolver.
  2. Return promise to the caller.
  3. Make a request to the TV channel to configure the current protection state of the TV channel according to the isProtected parameter.
  4. If an error occurs invoke resolver's reject algorithm with error as the value argument.
  5. When the request has been successfully completed:
    1. Invoke resolver's fulfill algorithm without assigning a value to the value argument.

Event handlers

The following are the event handlers (and their corresponding event types) that MUST be supported as attributes by the TVChannel object.

Event handler Event name Event type Short description
oncurrentprogramchanged currentprogramchanged TVCurrentProgramChangedEvent Handles the information of the currently broadcasted TV program that is changed by the TV channel.
onprotectionstatechanged protectionstatechanged TVProtectionStateChangedEvent Handles the information of the current protection state of the TV channel that is configured by the method setProtectionState.

TVProgram Interface

The TVProgram interface represents a bunch of properties and a set of operations related to the TV program.

readonly attribute DOMString eventId
MUST return the event ID of the TV program.
readonly attribute TVChannel channel
MUST return the TV channel which the TV program belongs to.
readonly attribute DOMString title
MUST return the title of the TV program.
readonly attribute unsigned long long startTime
MUST return the start time of the TV program.
readonly attribute unsigned long long duration
MUST return the duration of the TV program.
readonly attribute DOMString? description
MUST return the description of the TV program.
readonly attribute DOMString? language
MUST return the language of the TV program.
readonly attribute DOMString? rating
MUST return the rating of the TV program.

TVStartScanningOptions Dictionary

The TVStartScanningOptions dictionary contains the information for scanning the TV channels.

boolean isRescanned
Specifies whether or not the process of scanning the TV channels has to clear the currently scanned TV channels before scanning.

TVGetProgramsOptions Dictionary

The TVGetProgramsOptions dictionary contains the information for retrieving the TV programs.

unsigned long numberOfPrograms
Specifies how many TV programs to be retrieved from the time point of now. E.g., if this option is passed as 1, the method will return the TV program that is currently broadcasted by the TV channel at this moment; if it is passed as 2, the method will return the current and the next TV programs.
unsigned long long startTime
Specifies the start time of a time period which bounds the time slots of TV programs to be retrieved. Note that this option is only meaningful and considered when the numberOfPrograms option is passed as 0 or not passed.
unsigned long long duration
Specifies the duration of a time period which bounds the time slots of TV programs to be retrieved. Note that this option is only meaningful and considered when the numberOfPrograms option is passed as 0 or not passed.

TVParentalControlChangedEvent Interface

The TVParentalControlChangedEvent interface represents the event related to the state change of the TV parental control.

readonly attribute boolean isParentalControlLocked
MUST return the changed lock state of the TV parental control.

TVTunerChangedEvent Interface

The TVTunerChangedEvent interface represents the event related to the TV tuner that is added/removed by the TV device.

readonly attribute TVTunerChangedEventOperation operation
MUST return the type of operation that changes the TV tuner.
readonly attribute TVTuner tuner
MUST return the TV tuner that is added/removed by the TV device.

TVCurrentSourceChangedEvent Interface

The TVCurrentSourceChangedEvent interface represents the event related to the current TV source that is configured by the method setCurrentSource.

readonly attribute TVSource? source
MUST return the TV source that is currently configured by the TV tuner. MUST return null if the TV source is not configured.

TVEITBroadcastedEvent Interface

The TVEITBroadcastedEvent interface represents the event related to the available TV programs in the EIT that is broadcasted by the TV source.

readonly attribute TVProgram[] programs
MUST return the available TV programs in the EIT that is broadcasted by the TV source.

TVScanningStateChangedEvent Interface

The TVScanningStateChangedEvent interface represents the event related to the state of scanning the TV channels, which is changed by the TV source.

readonly attribute TVScanningState state
MUST return the state of scanning the TV channels, which is changed by the TV source.
readonly attribute TVChannel? channel
MUST return the TV channel that is scanned by the TV source. MUST return null if the state is not specified as "scanned".

TVCurrentChannelChangedEvent Interface

The TVCurrentChannelChangedEvent interface represents the event related to the currently streamed TV channel that is tuned by the method setCurrentChannel.

readonly attribute TVChannel? channel
MUST return the TV channel that is currently streamed by the TV tuner. MUST return null if the TV tuner is not streaming any data.

TVCurrentProgramChangedEvent Interface

The TVCurrentProgramChangedEvent interface represents the event related to the currently broadcasted TV program that is changed by the TV channel.

readonly attribute TVProgram? program
MUST return the TV program that is currently broadcasted by the TV channel. MUST return null if the TV tuner is not streaming any data.

TVProtectionStateChangedEvent Interface

The TVProtectionStateChangedEvent interface represents the event related to the current protection state of the TV channel that is configured by the method setProtectionState.

readonly attribute boolean isProtected
MUST return the current protection state that is configured by the TV channel.

Enumerations

The attribute type in the TVSource can have the following values:

dvb-t
The TV source works for Digital Video Broadcasting - Terrestrial.
dvb-c
The TV source works for Digital Video Broadcasting - Cable.
dvb-s
The TV source works for Digital Video Broadcasting - Satellite.

The attribute type in a TVChannel can have the following values:

tv
The TV channel is broadcasted as a regular TV type.
radio
The TV channel is broadcasted as a radio type.
data
The TV channel is broadcasted as a data type.

The attribute operation in the TVTunerChangedEvent can have the following values:

added
A TV tuner is added.
removed
A TV tuner is removed.

The attribute state in the TVScanningStateChangedEvent can have the following values:

cleared
The state of scanning the TV channels is cleared by the TV source, which means all the currently scanned TV channels are cleared before scanning.
scanned
The state of scanning the TV channels is scanned, which means a TV channel is successfully scanned by the TV source.
completed
The state of scanning the TV channels is completed by the TV source.
stopped
The state of scanning the TV channels is stopped by the TV source.

Acknowledgements

To be constructed.