<video>
and <audio>
HTML elements. The API is agnostic of any underlying audio or video
sourcing technologies.
This document is work in progress and is subject to change. The API is being developed based on requirements from the TV Control Working Group, and previously the TV Control Community Group.
An important issue for the Working Group to address is which functions are appropriate to be accessed from general web applications, and the mechanisms that may be needed to address any security and user privacy concerns.
Changes to this document may be tracked at the specification's GitHub repository.
This specification defines the TV Control API, which aims to enable web
applications to present audio and video media from broadcast TV and
radio, IPTV, or other sources, using the <audio>
and
<video>
HTML elements. The API provides access to
programme and service information and allows media recordings to be
scheduled and replayed.
TV functionality is accessed through the TVManager object which,
via the TVTuner and TVSource objects allows applications
to select and present a TV or Radio channel. Presentation is achieved
by obtaining a TVMediaStream object from the TVTuner and
assigning this to the srcObject
attribute of an
HTMLMediaElement
. The TVMediaStream
interface extends MediaStream
to allow buffering of
the received media, to enable pause/resume and timeshifted playback.
The purpose and distinction between the TVTuner and TVSource objects requires clarification. See this issue for details.
TVManager also allows recordings to be scheduled and replayed, and application control of the parental lock, to prevent unwanted viewing of particular channels or programs.
TVSource gives access to lists of available channels and programs, and allows applications to set the current channel to be presented. TVChannel contains TV and Radio channel attributes, and program schedule information, as a collection of TVProgram objects.
The EventHandler interface represents a callback used for event handlers as defined in [[!HTML5]].
The Event and EventTarget interfaces are defined in [[!DOM]].
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 [[ECMAScript]].
The MediaStream interface is defined in [[!MediaCapture-Streams]].
The MediaRecorder interface is defined in [[MediaStream-Recording]].
The video element, and audio HTMLMediaElement, TimeRanges interfaces are defined in [[!HTML5]].
The TextTrack, TextTrackCue, and TrackEvent interfaces are defined in [[!HTML5]]
partial interface Navigator { [SameObject] readonly attribute TVManager tv; };
tv
of type TVManager, readonly
The TVManager interface represents a bunch of properties and a set of operations that can be used to manage the TV/Radio device.
interface TVManager : EventTarget { Promise<sequence<TVTuner>> getTuners (); Promise<TVRecording> addRecording (TVAddRecordingOptions option); Promise<void> removeRecording (DOMString id); Promise<sequence<TVRecording>> getRecordings (optional TVGetRecordingsOptions options); Promise<void> setParentalControlPin (DOMString oldPin, DOMString newPin); Promise<void> setParentalControl (DOMString pin, boolean isLocked); Promise<sequence<TVCICard>> getCICards (); readonly attribute unsigned long long totalRecordingSize; readonly attribute unsigned long long availableRecordingSize; readonly attribute boolean isParentalControlled; attribute EventHandler ontunerchanged; attribute EventHandler onrecordingchanged; attribute EventHandler onparentalcontrolchanged; attribute EventHandler oncicardchanged; };
totalRecordingSize
of type unsigned long long, readonly
availableRecordingSize
of type unsigned long long, readonly
isParentalControlled
of type boolean, readonly
ontunerchanged
of type EventHandler
tunerchanged
event of type
TVTunerChangedEvent, fired when the TV/Radio device detects
a tuner is added/removed.
onrecordingchanged
of type EventHandler
recordingchanged
event of type
TVRecordingChangedEvent, fired when the recording time frame
or the state of the TV/Radio recording has been changed.
onparentalcontrolchanged
of type
EventHandler
parentalcontrolchanged
event, fired when
the parental control status is changed.
oncicardchanged
of type EventHandler
cicardchanged
event, fired when the CI
(Common Interface) card status is changed.
getTuners
Promise
that will be used to notify the caller
about the result of the operation, which is an array of
TVTuner elements.
Promise<sequence<TVTuner>>
addRecording
Promise
that will be used to notify the caller
about the result of the operation, which is a newly-created
TVRecording object.Promise
should be rejected. Applications may
handle this situation with their own strategy, such as explicitly
removing the conflicts and re-adding the one to conserve.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
option |
TVAddRecordingOptions
|
✘ | ✘ | Specifies the options for adding recording. |
Promise<TVRecording>
removeRecording
Promise
that will be used to notify the
caller about the result of the operation.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
id |
DOMString
|
✘ | ✘ | Specifies the ID of the recording to be removed. |
Promise<void>
getRecordings
Promise
that will be used to notify the caller
about the result of the operation.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
options |
TVGetRecordingsOptions
|
✘ | ✔ | Specifies the options for getting recordings. |
Promise<sequence<TVRecording>>
setParentalControlPin
Promise
that will be used to notify the caller
about the result of the operation. Note that the
Promise
may be rejected with an
InvalidAccessError
if the old PIN does not match the
current one.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
oldPin |
DOMString
|
✘ | ✘ | Specifies the old PIN used for parental control. |
newPin |
DOMString
|
✘ | ✘ | Specifies the new PIN used for parental control. |
Promise<void>
setParentalControl
Promise
that will be used to
notify the caller about the result of the operation. Note that the
Promise
may be rejected with an
InvalidAccessError
if the PIN does not match the
current one.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
pin |
DOMString
|
✘ | ✘ | Specifies the PIN used for parental control. |
isLocked |
boolean
|
✘ | ✘ | Specifies the parental control status. |
Promise<void>
getCICards
Promise
that will be used to
notify the caller about the result of the operation, which is an
array of TVCICard elements.
Promise<sequence<TVCICard>>
The getTuners
method when invoked MUST run
the following steps:
Promise
object and resolver be its associated
resolver
.
value
argument.
value
argument.
The addRecording
method when invoked MUST run
the following steps:
Promise
object and resolver be its associated
resolver
.
options
parameter.
value
argument.
value
argument.
The removeRecording
method when invoked MUST
run the following steps:
Promise
object and resolver be its associated
resolver
.
value
argument.
value
argument.
The getRecordings
method when invoked MUST
run the following steps:
Promise
object and resolver be its associated
resolver
.
options
parameter.
value
argument.
value
argument.
The setParentalControlPin
method when invoked
MUST run the following steps:
Promise
object and resolver be its associated
resolver
.
newPin
parameter.
value
argument.
value
argument.
The setParentalControl
method when invoked
MUST run the following steps:
Promise
object and resolver be its associated
resolver
.
isLocked
parameter.
value
argument.
value
argument.
The getCICards
method when invoked MUST run
the following steps:
Promise
object and resolver be its associated
resolver
.
value
argument.
value
argument.
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/Radio tuner that is added/removed by the device. |
onrecordingchanged
|
recordingchanged
|
TVRecordingChangedEvent
|
Handles the information of the updates for TV/Radio recordings. |
onparentalcontrolchanged
|
parentalcontrolchanged
|
Event
|
Handles the information of the status changes for parental control. |
oncicardchanged
|
cicardchanged
|
TVCICardChangedEvent
|
Handles the information of the status changes of the TV CI (Common Interface) card in the TV device. |
The TVTuner interface represents a bunch of properties and a set of operations related to TV/Radio tuner devices.
interface TVTuner : EventTarget { sequence<TVSourceType> getSupportedSourceTypes (); Promise<sequence<TVSource>> getSources (); Promise<void> setCurrentSource (TVSourceType sourceType); readonly attribute DOMString id; readonly attribute TVSource? currentSource; [SameObject] readonly attribute TVMediaStream? stream; readonly attribute double signalStrength; readonly attribute boolean isRecordable; attribute EventHandler oncurrentsourcechanged; };
id
of type DOMString, readonly
currentSource
of type TVSource, readonly , nullable
stream
of type TVMediaStream, readonly , nullable
TVMediaStream
object extended
from MediaStream
and currently streamed by the
TV tuner, which can be played by the video
element by assigning the TVMediaStream
(MediaStream
) to the
HTMLMediaElement
's srcObject
attribute and can be recorded by the
MediaRecorder
.signalStrength
of type double, readonly
isRecordable
of type boolean, readonly
oncurrentsourcechanged
of type EventHandler
currentsourcechanged
event of type
TVCurrentSourceChangedEvent, fired when the method
setCurrentSource
is invoked to configure the
current TV/Radio source.
getSupportedSourceTypes
sequence<TVSourceType>
getSources
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/Radio tuner.
Promise<sequence<TVSource>>
setCurrentSource
sourceType
parameter. It
returns a new Promise
that will be used to
notify the caller about the result of the operation.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
sourceType |
TVSourceType
|
✘ | ✘ | Specifies the TV/Radio source type for configuring the current source. |
Promise<void>
The getSources
method when invoked MUST run
the following steps:
Promise
object and resolver be its associated
resolver
.
value
argument.
TVSource
elements.
value
argument.
The setCurrentSource
method when invoked MUST
run the following steps:
Promise
object and resolver be its associated
resolver
.
sourceType
parameter.
value
argument.
value
argument.
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/Radio source that is
configured by the method setCurrentSource .
|
The TVSource interface represents a bunch of properties and a set of operations related to a TV/Radio source.
interface TVSource : EventTarget { Promise<sequence<TVChannel>> getChannels (); Promise<void> setCurrentChannel (DOMString channelNumber); Promise<void> startScanning (optional TVStartScanningOptions options); Promise<void> stopScanning (); readonly attribute TVTuner tuner; readonly attribute TVSourceType type; readonly attribute boolean isScanning; readonly attribute TVChannel? currentChannel; attribute EventHandler oncurrentchannelchanged; attribute EventHandler oneitbroadcasted; attribute EventHandler onemergencyalerted; attribute EventHandler onscanningstatechanged; };
tuner
of type TVTuner, readonly
type
of type TVSourceType, readonly
isScanning
of type boolean, readonly
currentChannel
of type TVChannel, readonly , nullable
oncurrentchannelchanged
of type
EventHandler
currentchannelchanged
event of type
TVCurrentChannelChangedEvent, fired when the method
setCurrentChannel
is invoked to tune the
currently streamed TV/Radio channel.
oneitbroadcasted
of type EventHandler
eitbroadcasted
event of type
TVEITBroadcastedEvent, fired when the Event Information
Table (EIT) is broadcasted by the TV source.
onemergencyalerted
of type EventHandler
emergencyalerted
event of type
TVEmergencyAlertedEvent, fired when an emergency, such as
earthquake or tsunami, occurs and is broadcasted by the TV/Radio
source.
onscanningstatechanged
of type EventHandler
scanningstatechanged
event of type
TVScanningStateChangedEvent, fired when the state of
scanning the TV/Radio channels is changed by the source. E.g., it
can be fired when the method startScanning
or
the method stopScanning
starts or stops
scanning the TV/Radio channels, or when a channel is found during
the channel scan.
getChannels
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 source. And if
parental control is enabled, the array of TVChannel elements
should exclude the locked channels. Note that the
Promise
may be rejected with an
InvalidStateError
if this method gets called during
channel scanning.
Promise<sequence<TVChannel>>
setCurrentChannel
channelNumber
parameter. It returns a
new Promise
that will be used to notify the
caller about the result of the operation. Note that the
Promise
may be rejected with an
InvalidStateError
if this method is called during
channel scanning, or be rejected with an
InvalidAccessError
if parental control is enabled and
the channel is locked.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
channelNumber |
DOMString
|
✘ | ✘ | Specifies the TV/Radio channel number for tuning the currently streamed TV/Radio channel. |
Promise<void>
startScanning
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 at some setup stages, so that the method
getChannels
can retrieve the channels that have
successfully been scanned by the source. Besides, due to some
constraints of tuner modules, scanning and streaming are not
encouraged to run at the same time.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
options |
TVStartScanningOptions
|
✘ | ✔ |
Specifies the options for scanning the TV/Radio channels.
The isRescanned option in the
options parameter specifies whether or not the
process of scanning the TV/Radio channels has to clear the
currently scanned TV/Radio channels before scanning; if it
is not passed, this method will rescan all the TV/Radio
channels as if it is passed as true .
|
Promise<void>
stopScanning
Promise
that
will be used to notify the caller about the result of the
operation.
Promise<void>
The getChannels
method when invoked MUST run
the following steps:
Promise
object and resolver be its associated
resolver
.
value
argument.
value
argument.
The setCurrentChannel
method when invoked
MUST run the following steps:
Promise
object and resolver be its associated
resolver
.
channelNumber
parameter.
value
argument.
value
argument.
The startScanning
method when invoked MUST
run the following steps:
Promise
object and resolver be its associated
resolver
.
options
parameter. If the
isRescanned
option in the options
parameter
is not passed or it is passed as true
, the user agent MUST clear the
currently scanned TV/Radio channels before scanning; if it is passed
as false
, the user agent will simply scan additional TV/Radio
channels which haven't been scanned yet.
value
argument.
value
argument.
The stopScanning
method when invoked MUST run
the following steps:
Promise
object and resolver be its associated
resolver
.
value
argument.
value
argument.
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/Radio
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. |
onemergencyalerted
|
emergencyalerted
|
TVEmergencyAlertedEvent
|
Handles the information of the emergency alert when an emergency, such as earthquake or tsunami, occurs and is broadcasted by the TV/Radio source. |
onscanningstatechanged
|
scanningstatechanged
|
TVScanningStateChangedEvent
|
Handles the information of the state of scanning the TV/Radio channels, which is changed by the source. |
The TVChannel interface represents a bunch of properties and a set of operations related to the TV/Radio channel.
interface TVChannel : EventTarget { Promise<sequence<TVProgram>> getPrograms (optional TVGetProgramsOptions options); Promise<TVProgram> getCurrentProgram (); Promise<sequence<TVApplication>> getApplications (); Promise<void> setParentalLock (DOMString pin, boolean isLocked); readonly attribute TVSource source; readonly attribute TVChannelType type; readonly attribute TVChannelAttributes attributes; readonly attribute DOMString name; readonly attribute DOMString number; readonly attribute boolean isEmergency; readonly attribute boolean isFree; readonly attribute DOMString? casSystemId; readonly attribute boolean isParentalLocked; attribute EventHandler onparentallockchanged; };
source
of type TVSource, readonly
type
of type TVChannelType, readonly
attributes
of type TVChannelAttributes, readonly
"NHK"
, etc.
name
of type DOMString, readonly
"CNN"
, "NHK"
, etc.
number
of type DOMString, readonly
"12-1"
, "12-2"
, etc.
isEmergency
of type boolean, readonly
isFree
of type boolean, readonly
casSystemId
of type DOMString, readonly , nullable
isParentalLocked
of type boolean, readonly
onparentallockchanged
of type EventHandler
parentallockchanged
event, fired when the
parental lock status of the TV/Radio channel is changed.
getPrograms
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/Radio channel.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
options |
TVGetProgramsOptions
|
✘ | ✔ | Specifies the options for retrieving the TV/Radio programs. If this parameter is not passed, this method will return all the available TV/Radio programs. |
Promise<sequence<TVProgram>>
getCurrentProgram
Promise
that will be used to notify the caller
about the result of the operation, which is a TVProgram
element that belongs to the channel.
Promise<TVProgram>
getApplications
Promise
that will be used to notify the caller
about the result of the operation, which is an array of
TVApplication elements that belong to the TV/Radio channel.
Promise<sequence<TVApplication>>
setParentalLock
Promise
that will be used to
notify the caller about the result of the operation.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
pin |
DOMString
|
✘ | ✘ | Specifies the PIN used for parental control. |
isLocked |
boolean
|
✘ | ✘ | Specifies the parental lock status for the channel. |
Promise<void>
The getPrograms
method when invoked MUST run
the following steps:
Promise
object and resolver be its associated
resolver
.
options
parameter.
value
argument.
value
argument.
The getCurrentProgram
method when invoked
MUST run the following steps:
Promise
object and resolver be its associated
resolver
.
value
argument.
value
argument.
The setParentalLock
method when invoked MUST
run the following steps:
Promise
object and resolver be its associated
resolver
.
isLocked
parameter.
pin
parameter does not match the current PIN
or an error occurs invoke resolver's reject algorithm with
error as the value
argument.
value
argument.
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 |
---|---|---|---|
onparentallockchanged
|
parentallockchanged
|
Event
|
Handles the information of the parental control status change for the TV/Radio channel. |
In general the current API design is agnostic towards the supported underlying transmission and systems technology. Just the TVSourceType enumeration refers to specific technology. However IMHO there must be a mechanism when it comes to returning technology specific data. The idea here is to introduce a general TVChannelAttributes structure which acts as a base interface, from which technology dependant sub interfaces (in this proposal for DVB and DAB) are derived.
The TVChannelAttributes interface represents a bunch of properties and a set of operations related to technology related functions of different TV/Radio transmission and system specifications. The TVChannelAttributes interface is the parent interface for a hierarchy of technology specific subinterfaces determined by TVSource and its TVSourceType properties.
interface TVChannelAttributes : EventTarget { attribute EventHandler onattributeschanged; };
onattributeschanged
of type EventHandler
onattributeschanged
event, fired when the
attributes of the TV/Radio channel are changed.
The TVDVBChannelAttributes interface represents DVB channel attributes
interface TVDVBChannelAttributes : TVChannelAttributes { readonly attribute DOMString networkId; readonly attribute DOMString transportStreamId; readonly attribute DOMString serviceId; };
networkId
of type DOMString, readonly
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.
transportStreamId
of type DOMString, readonly
serviceId
of type DOMString, readonly
The TVDABChannelAttributes interface represents DVB channel attributes
interface TVDABChannelAttributes : TVChannelAttributes { readonly attribute DOMString ensembleId; readonly attribute DOMString serviceId; };
ensembleId
of type DOMString, readonly
serviceId
of type DOMString, readonly
Should we introduce more specific application type interfaces here. e.g. for the DAB/DVB User applications (Slideshow, DL, Journaline, HbbTV, MHEG)? Or are we happy with just delivering the applicationData to the developers.
The TVApplication interface represents a bunch of properties and a set of operations related to technology related functions of different TV/Radio applications. The TVApplication interface can be the parent interface for a hierarchy of technology specific subinterfaces TVApplicationType
interface TVApplication : EventTarget { readonly attribute TVApplicationType type; readonly attribute object? applicationData; attribute EventHandler onapplicationchanged; };
type
of type TVApplicationType, readonly
applicationData
of type object, readonly , nullable
onapplicationchanged
of type EventHandler
onapplicationchanged
event, fired when the
application of the TV/Radio channel is changed.
The TVProgram interface represents a bunch of properties and a set of operations related to the TV/Radio program.
interface TVProgram { sequence<DOMString> getAudioLanguages (); sequence<DOMString> getSubtitleLanguages (); sequence<DOMString> getGenres (); readonly attribute DOMString eventId; readonly attribute TVChannel channel; readonly attribute DOMString title; readonly attribute unsigned long long startTime; readonly attribute unsigned long long duration; readonly attribute DOMString? shortDescription; readonly attribute DOMString? longDescription; readonly attribute DOMString? rating; readonly attribute boolean isFree; readonly attribute DOMString? seriesId; };
eventId
of type DOMString, readonly
channel
of type TVChannel, readonly
title
of type DOMString, readonly
startTime
of type unsigned long long, readonly
duration
of type unsigned long long, readonly
shortDescription
of type DOMString, readonly , nullable
longDescription
of type DOMString, readonly , nullable
rating
of type DOMString, readonly , nullable
isFree
of type boolean, readonly
seriesId
of type DOMString, readonly , nullable
getAudioLanguages
sequence<DOMString>
getSubtitleLanguages
sequence<DOMString>
getGenres
sequence<DOMString>
The TVTriggerCue interface represents a bunch of properties and
a set of operations related to the TV/Radio trigger, which may be used
to carry some information via in-band or out-of-band mechanism based on
the current playing content. It's inherited from the
TextTrackCue
interface, which requires
startTime
and endTime
, and can be accessed by
the video
or audio
element by
adding the TextTrackCue
to the
TextTrack
associated with the
HTMLMediaElement
. Besides, the
TextTrack
can rely on its
oncuechange
event to realize a TV/Radio trigger becomes
active or dismissed.
interface TVTriggerCue : TextTrackCue { readonly attribute TVTriggerType type; readonly attribute DOMString? title; readonly attribute DOMString? url; readonly attribute TVChannel? channel; readonly attribute TVMediaStream? stream; readonly attribute object? additionalData; };
type
of type TVTriggerType, readonly
title
of type DOMString, readonly , nullable
url
of type DOMString, readonly , nullable
channel
of type TVChannel, readonly , nullable
stream
of type TVMediaStream, readonly , nullable
additionalData
of type object, readonly , nullable
The TVRecording interface represents a bunch of properties and a
set of operations related to the TV/Radio recording. The recording
should automatically start recording at the specified start time. And
it may stop either at the specified end time, by an explicit
stop()
call, or be interrupted by the user agent due to a
channel switch against the required underlying resource (i.e. the same
tuner which the recording channel belongs to since watching takes
priority over recording), or an error.
interface TVRecording { Promise<TVMediaStream> getStream (); Promise<void> stop (); readonly attribute DOMString id; readonly attribute TVChannel channel; readonly attribute TVProgram? program; readonly attribute unsigned long long startTime; readonly attribute unsigned long long endTime; readonly attribute TVRecordingState state; readonly attribute unsigned long long size; readonly attribute unsigned long long duration; attribute DOMString description; attribute EventHandler onrecordingchanged; };
id
of type DOMString, readonly
channel
of type TVChannel, readonly
program
of type TVProgram, readonly , nullable
stopped
.
startTime
of type unsigned long long, readonly
endTime
of type unsigned long long, readonly
state
of type TVRecordingState, readonly
size
of type unsigned long long, readonly
duration
of type unsigned long long, readonly
description
of type DOMString
onrecordingchanged
of type EventHandler
recordingchanged
event of type
TVRecordingChangedEvent, fired when the recording time frame
or the state of the TV/Radio recording has been changed.
getStream
MediaStream
and can be played by the
video
element by assigning the
TVMediaStream to the HTMLMediaElement
's
srcObject
attribute. MUST return null if the
TV/Radio recording hasn't actually recorded anything. Note that the
Promise
may be rejected with an
InvalidAccessError
if parental control is enabled and
the recorded channel is locked.
Promise<TVMediaStream>
stop
Promise<void>
The getStream
method when invoked MUST run
the following steps:
Promise
object and resolver be its associated
resolver
.
value
argument.
value
argument.
The stop
method when invoked MUST run the
following steps:
Promise
object and resolver be its associated
resolver
.
value
argument.
value
argument.
The following are the event handlers (and their corresponding event types) that MUST be supported as attributes by the TVRecording object.
Event handler | Event name | Event type | Short description |
---|---|---|---|
onrecordingchanged
|
recordingchanged
|
TVRecordingChangedEvent
|
Handles the information of the updates for TV/Radio recordings. |
The TVMediaStream interface is an extended
MediaStream
with a buffering mechanism to support
basic seekability. It can be played by the video
oraudio
element by assigning the
TVMediaStream to the HTMLMediaElement
's
srcObject
attribute.
interface TVMediaStream : MediaStream { sequence<TextTrack> getTextTracks (); void addTextTrack (TextTrack textTrack); void removeTextTrack (TextTrack textTrack); };
getTextTracks
sequence<TextTrack>
addTextTrack
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
textTrack |
TextTrack
|
✘ | ✘ | The TextTrack object to be added. |
void
removeTextTrack
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
textTrack |
TextTrack
|
✘ | ✘ | The TextTrack object to be removed. |
void
HTMLMediaElement
Attributes When Playing a
TVMediaStream
The nature of no buffering of the MediaStream
places certain restrictions on the behavior and attribute values of
the associated HTMLMediaElement
and on the
operations that can be performed on it. Yet since
TVMediaStream is with a buffered mechanism to support basic
seekability, it may be less restrictive to some extent, as shown
below:
Attribute Name | Attribute Type | Valid Values When Using a TVMediaStream | Additional considerations |
---|---|---|---|
currentSrc
|
DOMString
|
The empty string |
When srcObject is specified the User Agent MUST
set this to the empty string. (Same as
MediaStream .)
|
preload
|
DOMString
|
none |
A TVMediaStream cannot be preloaded. (Same as
MediaStream .)
|
buffered
|
TimeRanges
|
Same as HTMLMediaElement .
|
Unlock the restriction applied by
MediaStream .
|
networkState
|
unsigned short
|
NETWORK_IDLE |
The media element does not fetch the TVMediaStream so
there is no network traffic. (Same as
MediaStream .)
|
readyState
|
unsigned short
|
HAVE_NOTHING, HAVE_ENOUGH_DATA |
A TVMediaStream may be created before there is any data
available, for example when a stream is received from a remote
peer. The value of the readyState of the media
element MUST be HAVE_NOTHING before the first media
arrives and HAVE_ENOUGH_DATA once the first media has
arrived. (Same as MediaStream .)
|
currentTime
|
double
|
Same as HTMLMediaElement .
|
Unlock the restriction applied by
MediaStream .
|
duration
|
unrestricted double
|
Same as HTMLMediaElement .
|
Unlock the restriction applied by
MediaStream .
|
seeking
|
boolean
|
Same as HTMLMediaElement .
|
Unlock the restriction applied by
MediaStream .
|
defaultPlaybackRate
|
double
|
Same as HTMLMediaElement .
|
Unlock the restriction applied by
MediaStream .
|
playbackRate
|
double
|
Same as HTMLMediaElement .
|
Unlock the restriction applied by
MediaStream .
|
played
|
TimeRanges
|
Same as HTMLMediaElement .
|
Unlock the restriction applied by
MediaStream .
|
seekable
|
TimeRanges
|
Same as HTMLMediaElement .
|
Unlock the restriction applied by
MediaStream .
|
loop
|
boolean
|
Same as HTMLMediaElement .
|
Unlock the restriction applied by
MediaStream .
|
Applications may utilize TVRecording and TVMediaStream
to fulfill time-shifting scenarios. When time-shifting is enabled, it
may add a TV/Radio recording for the current playing channel without
specifying start time, which makes the recording starts from now on,
or instead by specifying the live TV/Radio program. (The user agent
should be able to play and record the same channel at the same time.)
Then when it comes to switch to the time-shifted content, the
TVMediaStream generated from the TV/Radio recording can be
assigned to the video
or
audio
element used for playing the current
MediaStream
. So the application may play with the
video
or audio
element to set
proper playback rates, seek to specific time, play/pause the buffered
stream, and listen to some correspondent events. And when
time-shifting is switched off (i.e. the recorded content has been
fast forwarded to the current end), the application should assign the
original MediaStream
back to the
video
or audio
element.
Please note applications may need to regularly clean up old TV/Radio
recordings used for time-shifting.
The TVCICard interface represents a bunch of properties related to CI (Common Interface) card which is used to decrypt encrypted TV channel.
interface TVCICard { readonly attribute TVCICardState state; readonly attribute DOMString casSystemId; readonly attribute boolean isInUse; };
state
of type TVCICardState, readonly
casSystemId
of type DOMString, readonly
isInUse
of type boolean, readonly
The TVStartScanningOptions dictionary contains the information for scanning the TV/Radio channels.
dictionary TVStartScanningOptions { boolean isRescanned; };
isRescanned
of type boolean
The TVGetProgramsOptions dictionary contains the information for retrieving the TV/Radio programs.
dictionary TVGetProgramsOptions { unsigned long long startTime; unsigned long long endTime; DOMString genre; };
startTime
of type unsigned long long
endTime
of type unsigned long long
genre
of type DOMString
The TVAddRecordingOptions dictionary contains the information for adding a TV/Radio recording.
dictionary TVAddRecordingOptions { required DOMString description; required TVChannel channel; TVProgram? program; unsigned long long? startTime; unsigned long long? endTime; };
description
of type DOMString, required
channel
of type TVChannel, required
program
of type TVProgram, nullable
startTime
and endTime
.
startTime
of type unsigned long long, nullable
program
is specified.
endTime
of type unsigned long long, nullable
stop()
call of TVRecording or the user agent
forces it to stop due to resource control. Please note this could
also be ommited and auto determined if program
is
specified.
The TVGetRecordingsOptions dictionary contains the information for retrieving the TV/Radio recordings.
dictionary TVGetRecordingsOptions { TVRecordingState? state; DOMString? id; };
state
of type TVRecordingState, nullable
id
of type DOMString, nullable
The TVTunerChangedEvent interface represents the event related to the TV/Radio tuner that is added/removed by the device.
interface TVTunerChangedEvent : Event { readonly attribute TVTunerChangedEventOperation operation; readonly attribute DOMString id; };
operation
of type TVTunerChangedEventOperation, readonly
id
of type DOMString, readonly
The TVCurrentSourceChangedEvent interface represents the event
related to the current TV/Radio source that is configured by the method
setCurrentSource
.
interface TVCurrentSourceChangedEvent : Event { readonly attribute TVSource? source; };
source
of type TVSource, readonly , nullable
The TVEITBroadcastedEvent interface represents the event related to the available TV programs in the EIT that is broadcasted by the TV source.
interface TVEITBroadcastedEvent : Event { readonly attribute object programs; };
programs
of type object, readonly
TVProgram
instances. The cached
value for this array needs to go into an internal slot for the
object, and it should be cached there until the next time that the
underlying array changes when the cached value will be updated.
The TVEmergencyAlertedEvent interface represents the event related to the emergency alert that is broadcasted by the TV/Radio source.
interface TVEmergencyAlertedEvent : Event { readonly attribute DOMString? type; readonly attribute DOMString? severityLevel; readonly attribute DOMString? description; readonly attribute TVChannel? channel; readonly attribute DOMString? url; sequence<DOMString> getRegions (); };
type
of type DOMString, readonly , nullable
severityLevel
of type DOMString, readonly , nullable
description
of type DOMString, readonly , nullable
channel
of type TVChannel, readonly , nullable
url
of type DOMString, readonly , nullable
getRegions
sequence<DOMString>
The TVScanningStateChangedEvent interface represents the event related to the state of channel scanning, which is changed by the TV/Radio source.
interface TVScanningStateChangedEvent : Event { readonly attribute TVScanningState state; readonly attribute TVChannel? channel; };
state
of type TVScanningState, readonly
channel
of type TVChannel, readonly , nullable
state
is not
"scanned"
.
The TVCurrentChannelChangedEvent interface represents the event
related to the currently streamed TV/Radio channel that is tuned by the
method setCurrentChannel
.
interface TVCurrentChannelChangedEvent : Event { readonly attribute TVChannel? channel; };
channel
of type TVChannel, readonly , nullable
The TVRecordingChangedEvent interface represents the event related to the update of a TV/Radio recording.
interface TVRecordingChangedEvent : Event { readonly attribute DOMString id; readonly attribute boolean isTimeChange; readonly attribute boolean isStateChange; readonly attribute DOMString? errorName; };
id
of type DOMString, readonly
isTimeChange
of type boolean, readonly
isStateChange
of type boolean, readonly
errorName
of type DOMString, readonly , nullable
The TVCICardChangedEvent interface represents the event related to the changes in the state of the CI (Common Interface) card.
interface TVCICardChangedEvent : Event { readonly attribute TVCICardState state; readonly attribute DOMString casSystemId; };
state
of type TVCICardState, readonly
casSystemId
of type DOMString, readonly
The attribute type
in the TVSource can have the
following values:
enum TVSourceType { "dvb-t", "dvb-t2", "dvb-c", "dvb-c2", "dvb-s", "dvb-s2", "dvb-h", "dvb-sh", "atsc", "atsc-m/h", "isdb-t", "isdb-tb", "isdb-s", "isdb-c", "1seg", "dtmb", "cmmb", "t-dmb", "s-dmb", "dab", "drm", "fm", "AM" };
Enumeration description | |
---|---|
dvb-t
|
The source works for DVB-T (terrestrial). |
dvb-t2
|
The source works for DVB-T2 (terrestrial). |
dvb-c
|
The source works for DVB-C (cable). |
dvb-c2
|
The source works for DVB-C2 (cable). |
dvb-s
|
The source works for DVB-S (satellite). |
dvb-s2
|
The source works for DVB-S2 (satellite). |
dvb-h
|
The source works for DVB-H (handheld). |
dvb-sh
|
The source works for DVB-SH (satellite). |
atsc
|
The source works for ATSC (terrestrial/cable). |
atsc-m/h
|
The source works for ATSC-M/H (mobile/handheld). |
isdb-t
|
The source works for ISDB-T (terrestrial). |
isdb-tb
|
The source works for ISDB-Tb (terrestrial, Brazil). |
isdb-s
|
The source works for ISDB-S (satellite). |
isdb-c
|
The source works for ISDB-C (cable). |
1seg
|
The source works for 1seg (handheld). |
dtmb
|
The source works for DTMB (terrestrial). |
cmmb
|
The source works for CMMB (handheld). |
t-dmb
|
The source works for T-DMB (terrestrial). |
s-dmb
|
The source works for S-DMB (satellite). |
dab
|
The source works for DAB (terrestrial). |
drm
|
The source works for DRM (terrestrial). |
fm
|
The source works for FM (terrestrial). |
AM
|
The source works for AM (terrestrial). |
The attribute type
in a TVChannel can have the
following values:
enum TVChannelType { "tv", "radio", "data" };
Enumeration description | |
---|---|
tv
|
The channel is broadcasted as a regular TV type. |
radio
|
The channel is broadcasted as a radio type. |
data
|
The channel is broadcasted as a data type. |
The attribute TVApplicationType
in a TVApplication
can have the following values:
enum TVApplicationType { "hbbtv", "mheg", "sls", "dl", "jl" };
Enumeration description | |
---|---|
hbbtv
|
The application is a tv hbbtv application |
mheg
|
The application is a tv mheg application |
sls
|
The application radio slideshow application |
dl
|
The application radio dynamic label application |
jl
|
The application radio journaline application |
The attribute operation
in the TVTunerChangedEvent
can have the following values:
enum TVTunerChangedEventOperation { "added", "removed" };
Enumeration description | |
---|---|
added
|
A tuner is added. |
removed
|
A tuner is removed. |
The attribute state
in the
TVScanningStateChangedEvent can have the following values:
enum TVScanningState { "cleared", "scanned", "completed", "stopped" };
Enumeration description | |
---|---|
cleared
|
The currently scanned TV/Radio channels have been cleared. This event may be fired before a channel scan is started. |
scanned
|
A TV/Radio channel has been found by the source during the
channel scan. The channel attribute in the
TVScanningStateChangedEvent object references the
channel found.
|
completed
|
The channel scan has completed. |
stopped
|
The channel scan has been stopped. |
The attribute type
in the TVTriggerCue can have the
following values:
enum TVTriggerType { "channel-change", "time", "content-boundary", "fingerprint", "watermark", "context", "segment", "caption" };
Enumeration description | |
---|---|
channel-change
|
Triggers when channel is switched. |
time
|
Triggers based on date and time. |
content-boundary
|
Triggers based on content boundary. |
fingerprint
|
Triggers based on content fingerprints. |
watermark
|
Triggers based on content watermarks. |
context
|
Triggers based on contextual information in content. |
segment
|
Triggers based on program chapters or other segments within the program. |
caption
|
Triggers based on subtitle captions. |
The attribute state
in TVRecording can have the
following values:
enum TVRecordingState { "scheduled", "recording", "stopped" };
Enumeration description | |
---|---|
scheduled
|
The state of recording is scheduled. |
recording
|
The state of recording is currently on. |
stopped
|
The state of recording is stopped from scheduled or
canceled from recording .
|
The attribute state
in TVCICard can have the
following values:
enum TVCICardState { "inserted", "accepted", "removed", "error" };
Enumeration description | |
---|---|
inserted
|
The CI card is inserted. |
accepted
|
The CI card is accepted. |
removed
|
The CI card is removed. |
error
|
The CI Card has encountered an error. |
The following people have contributed to this draft specification through their participation in the TV Control API Community Group: Kazayuki Ashimura, Marco Chen, Daniel Davis, Francois Daoust, Yoshiharu Dewa, Paul Higgs, Bin Hu, Shelly Lin, Sangwhan Moon, Chris Needham, John Piesing.
All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes.
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.