skip to navigation
February 28th, 2011 01:18 PM

Using Time Index Seeking to Approximate FF and REW

The media players developed by the current device manufacturers are optimized to support seeking using time index values that are passed between the widget and the media server. Supporting true fast forward and rewind functionality is resource intensive and not yet available on current Connected TV devices. An alternative approach is to use time index seeking to enable consumers to skip forward and skip backward within in a stream in multi-second increments from a relative or absolute time index. This workaround is very useful when playing videos that are longer than a few minutes.

Media Player Seek() Method

The media player’s seek() method is defined as follows:

void offset, Boolean absolute);

The method tells the media player to seek to the specified offset in seconds. If true is passed as the optional absolute parameter, then the offset is considered to be an absolute offset rather than a relative offset from the current playback position.

Time Index Seeking Example

The following example shows how to modify the onscreen Media Transport Controls to use forward and reverse time index seeking to approximate fast forward and rewind functionality. This example ‘skips’ ahead and ‘skips’ behind the current media player playhead position in 10 second increments.

Here are the available onscreen media transport controls:

Media Transport Control Overlay

The onscreen transport buttons are not mapped to computer keyboard keys. For the TV Simulator use the ‘Up Arrow’ to launch the Media Transport Control Overlay. Use the ‘Right Arrow’ and ‘Left Arrow’ to navigate to, and ‘Enter’ to select the fast forward and rewind buttons. See the Keyboard to Remote Control Mapping table for other mappings.

STEP  ONE: Handle the Onscreen Media Transport Overlay Buttons

Fast forward and rewind buttons are built in to the Media Transport Overlay and can be activated by toggling the configuration flags fastforwardButton and rewindButton to true in the config object.

To override any button behavior, you must subscribe to the overlay’s onTransportButtonPress event and provide your own event handlers in the overlay control instantiation. Call the method event.preventDefault() to stop the default KONtx.mediaplayer.control.fastforward() and rewind() methods from being called. The following example uses the method to skip ahead and behind by 10 seconds.


this.controls.overlay = new KONtx.control.MediaTransportOverlay({
    fastforwardButton: true,
    rewindButton: true,
    events: {
        onTransportButtonPress: function(event) {
            if(event.payload.button == "fastforward") {
            } else if(event.payload.button == "rewind") {

The TV Simulator fullscreen view with the full complement of media transport controls is displayed below:

STEP TWO: Handle the Remote Control FF and REW Keys

The implementation of the remote control fast forward and rewind keys varies by device. For some devices the key codes for fast forward and rewind may not be standard and the transport keys may be protected by a specific command key sequence. In some cases, the Yahoo! Connected TV Platform may not receive remote control key presses from the device.

To listen for the fast forward and rewind remote control key presses, subscribe to the onFastForwardRemoteKeyPress and onRewindRemoteKeyPress events. As in Step One above, provide your own event handlers and call the method event.preventDefault() to stop the default KONtx.mediaplayer.control.fastforward() and rewind() methods from being called. The following example uses the method to skip ahead and behind by 10 seconds when the remote control keys are pressed.


_registerHandlers: function() {
    if(this._boundPlayerHandler) {

    this._boundPlayerHandler = this._playerDispatcher.subscribeTo(KONtx.mediaplayer,
        ['onStateChange', 'onPlaylistEnd', 'onStreamLoadError',
         'onRewindRemoteKeyPress','onFastForwardRemoteKeyPress'], this);

_unregisterHandlers: function() {
    if(this._boundPlayerHandler) {
            ['onStateChange', 'onPlaylistEnd', 'onStreamLoadError',
        this._boundPlayerHandler = null;

_playerDispatcher: function(event) {

    switch(event.type) {
        case 'onStateChange':
            if(event.payload.newState == KONtx.mediaplayer.constants.states.STOP) {
            if(event.payload.newState == KONtx.mediaplayer.constants.states.ERROR ||
               event.payload.newState == KONtx.mediaplayer.constants.states.UNKNOWN) {
        case 'onPlaylistEnd':
        case 'onStreamLoadError':
        case 'onFastForwardRemoteKeyPress':
        case 'onRewindRemoteKeyPress':

Testing and Troubleshooting Tips

  • You can test for remote control key presses by creating an event listener as follows:
    this.addEventListener('keydown', function(event) {
        log('KEY DOWN EVENT',$dump(event,4));
    }, false);
  • The object that holds the constants for commonly used key codes. Call the following:
    log('KEYS ',$dump(;

    to see these values:

    KEYS {
        PAUSE => 19,
        REWIND => 412,
        STOP => 413,
        PLAY => 415,
        FORWARD => 417,
        BACK => 461,
        F10 => 121,
        BACKSPACE => 8,
        SELECT => 13,
        ENTER => 13,
        DELETE => 46,
        ESCAPE => 27,
        SPACE => 32,
        TAB => 9,
        INSERT => 45,
        HOME => 36,
        END => 35,
        LEFT => 37,
        RIGHT => 39,
        UP => 38,
        DOWN => 40,
        PAGE_DOWN => 34,
        PAGE_UP => 33,
        NUM_LOCK => 144,
        SCROLL_LOCK => 145,
        CAPS_LOCK => 20,
        PRINTSCREEN => 44,
        ALT => 18,
        SHIFT => 16,
        CONTROL => 17,
        VOLUME_UP => 447,
        VOLUME_DOWN => 448,
        MUTE => 449
  • The Simulator Console /key command can be used for transport controls. You can send:
    /key play
    /key pause
    /key stop
    /key rewind
    /key forward (or fastfwd)
    /key up
    /key down
    /key left
    /key right
    /key select (or enter)
    /key home
    /key red
    /key blue
    /key green
    /key yellow
  • See the Installation Guide – Edit the Simulator Settings:

    The TV Simulator uses the video playback software library GStreamer to decode and render video. Typically, the software rendering provided by GStreamer is much slower than hardware optimized rasterization. You may find that for certain videos, the audio and video playback is not in sync. This is not representative of the media player behavior on Connected TV devices, but is an artifact of the Simulator’s use of GStreamer.

    Dual-processor mode is recommended to speed up video playback. By default, VMware runs in dual-processor mode. If you are using VirtualBox you need to manually switch the settings to dual-processor mode. If your VM is using all available processors and performance is still a problem, setting the value of video_skip_frames to 8 in the Simulator Settings improves CPU performance but degrades video playback by playing only 1 out of 9 frames. If CPU performance is not an issue, this value can be decreased for smoother video playback.

  • See the Developer FAQ:

    Some device-specific media players support seeking to particular times inside a piece of media by jumping to a relative or absolute offset. Video-seeking and time index changes require a special version of GStreamer (0.10.23) to test on the Simulator, so typically time index testing occurs on the TV/device. To support stopping at a particular point in a video, the event onTimeIndexChanged fires at one second intervals. Currently none of the devices in production support fast forward and rewind over HTTP streams.

  • See the Media Player API (pdf):

Leave a Reply