as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Develop
Test
Publish
Monetize
Engage users
Device specifications
Resources

Tunnel Mode Playback

The hardware decoder for some Fire TV devices supports playback of 4K @ 60 FPS. A video at this high resolution and frame rate creates aggressive timing requirements for the media pipeline. Due to kernel scheduling limitations, the app might not be able to render 4K frames at 16 msec interval. This limitation might cause frame drops and a sub-par movie experience. To get the best out of the hardware, use Tunnel Mode playback.

How to Enable Tunnel Mode Playback

The main changes required to enable Tunnel Mode playback are as follows:

  1. Query the AudioTrack session ID from AudioManager:

    AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    int audioSessionId = audioManager.generateAudioSessionId();
    
  2. Configure Video Decoder for Tunnel mode:

    format.setFeatureEnabled(MediaCodecInfo.CodecCapabilities.FEATURE_TunneledPlayback, true);
    
  3. Configure Video Decoder with the AudioTrack session ID.

    format.setInteger(android.media.MediaFormat.KEY_AUDIO_SESSION_ID, audioSessionId);
    
  4. Create AudioTrack with the previously queried session ID and set the AudioAttributes flag FLAG_HW_AV_SYNC.

    AudioAttributes attributes = new AudioAttributes.Builder()
      .setLegacyStreamType(AudioManager.STREAM_MUSIC)
      .setFlags(AudioAttributes.FLAG_HW_AV_SYNC)
      .build();
     AudioFormat format = new AudioFormat.Builder()
      .setEncoding(targetEncoding)
      .setSampleRate(sampleRate)
      .setChannelMask(channelConfig)
      .build();
     int mode = AudioTrack.MODE_STREAM;
     AudioTrack audioTrack = new AudioTrack(attributes, format, bufferSize, mode, audioSessionId);
    
  5. Do not call dequeueOutputBuffer and releaseOutputBuffer for video decoder.

  6. AudioTrack provides a write API that automatically constructs the additional header information. For details, see here.

More Details about Tunnel Mode Playback

For more details, refer to the Tunnel Mode Playback implementation in ExoPlayer 2:

Limitations of Tunneled Mode

This Tunneled Mode playback information here applies to all Fire TV devices that run Fire OS 6 or later, with these constraints:


Last updated: May 29, 2026