添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Media3 MediaSession
  • Media3 ExoPlayer
  • Media3 Transformer
  • Media3 UI
  • Jetpack MediaRouter
  • Platform APIs and behaviors
  • Legacy media APIs
  • Add camera capabilities Extend your app's reach Level up your media app Optimize for high quality

    When defining the formats that ExoPlayer supports, it's important to note that "media formats" are defined at multiple levels. From the lowest level to the highest, these are:

  • The format of the individual media samples (such as a frame of video or a frame of audio). These are sample formats . Note that a typical video file will contain media in at least two sample formats; one for video (for example, H.264) and one for audio (for example, AAC).
  • The format of the container that houses the media samples and associated metadata. These are container formats . A media file has a single container format (for example, MP4), which is commonly indicated by the file extension. Note that for some audio-only formats (for example, MP3), the sample and container formats may be the same.
  • Adaptive streaming technologies such as DASH, SmoothStreaming and HLS. These are not media formats as such, however it's still necessary to define what level of support ExoPlayer provides.
  • The following sections define ExoPlayer's support at each level, from highest to lowest. The last two sections describe support for standalone subtitle formats and HDR video playback.

    Adaptive streaming

    ExoPlayer supports DASH with multiple container formats. Media streams must be demuxed, meaning that video, audio, and text must be defined in distinct AdaptationSet elements in the DASH manifest (CEA-608 is an exception as described in the table below). The contained audio and video sample formats must also be supported (see the sample formats section for details).

    SmoothStreaming

    ExoPlayer supports SmoothStreaming with the FMP4 container format. Media streams must be demuxed, meaning that video, audio, and text must be defined in distinct StreamIndex elements in the SmoothStreaming manifest. The contained audio and video sample formats must also be supported (see the sample formats section for details).

    ExoPlayer supports HLS with multiple container formats. The contained audio and video sample formats must also be supported (see the sample formats section for details). We strongly encourage HLS content producers to generate high quality HLS streams, as described in this blog post .

    Progressive container formats

    Streams in the following container formats can be played directly by ExoPlayer. The contained audio and video sample formats must also be supported (see the Sample formats section for details). For image container and format support, see Images .

    * Seeking is unsupported because the container does not provide metadata (for example, a sample index) to allow a media player to perform a seek in an efficient way. If seeking is required, we suggest using a more appropriate container format.

    ** These extractors have FLAG_ENABLE_CONSTANT_BITRATE_SEEKING flags for enabling approximate seeking using a constant bitrate assumption. This functionality is not enabled by default. The simplest way to enable this functionality for all extractors that support it is to use DefaultExtractorsFactory.setConstantBitrateSeekingEnabled , as described here .

    *** The FLAC library extractor outputs raw audio, which can be handled by the framework on all API levels. The ExoPlayer library FLAC extractor outputs FLAC audio frames and so relies on having a FLAC decoder (for example, a MediaCodec decoder that handles FLAC (required from API level 27), or the FFmpeg library with FLAC enabled). The DefaultExtractorsFactory uses the extension extractor if the application was built with the FLAC library . Otherwise, it uses the ExoPlayer library extractor.

    ExoPlayer supports both live and on demand RTSP. Supported sample formats and network types are listed below.

    Supported sample formats

  • H264 (the SDP media description must include SPS/PPS data in the fmtp attribute for decoder initialization).
  • AAC (with ADTS bitstream).
  • Supported network types

  • RTP over UDP unicast (multicast is not supported).
  • Interleaved RTSP, RTP over RTSP using TCP.
  • Sample formats

    By default ExoPlayer uses Android's platform decoders. Hence the supported sample formats depend on the underlying platform rather than on ExoPlayer. Refer to Supported media formats for documentation on sample formats supported by Android devices. Note that individual devices may support additional formats beyond those listed.

    In addition to Android's platform decoders, ExoPlayer can also make use of software decoder extensions. These must be manually built and included in projects that wish to make use of them. We currently provide software decoder libraries for AV1 , VP9 , FLAC , Opus , FFmpeg , MIDI , IAMF and MPEG-H .

    FFmpeg library

    The FFmpeg library supports decoding a variety of different audio sample formats. You can choose which decoders to include when building the library, as documented in the library's README.md . The following table provides a mapping from audio sample format to the corresponding FFmpeg decoder name.

    ExoPlayer supports the following image formats. See Image Loading Libraries for how to integrate with external libraries that may provide support for a different set of formats.

    * The video part of HEIC motion photos can be obtained with MetadataRetriever and played as a standalone file.

    Standalone subtitle formats

    ExoPlayer supports standalone subtitle files in a variety of formats. Subtitle files can be side-loaded as described on the media items page .

    ExoPlayer handles extracting high dynamic range (HDR) video in various containers, including Dolby Vision in MP4 and HDR10+ in Matroska/WebM. Decoding and displaying HDR content depends on support from the Android platform and device. See HDR Video Playback to learn about checking for HDR decoding/display capabilities and limitations of HDR support across Android versions.

    When playing an HDR stream that requires support for a particular codec profile, ExoPlayer's default MediaCodec selector will pick a decoder that supports that profile (if available), even if another decoder for the same MIME type that doesn't support that profile appears higher up the codec list. This can result in selecting a software decoder in cases where the stream exceeds the capabilities of a hardware decoder for the same MIME type.

    Content and code samples on this page are subject to the licenses described in the Content License . Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

    Last updated 2025-03-28 UTC.

    [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-28 UTC."],[],[]]