Categories: Apps

Media3 1.6.0 — what’s new?



Posted by Andrew Lewis – Software Engineer

This article is cross-published on Medium

This release includes a host of bug fixes, performance improvements and new features. Read on to find out more, and as always please check out the full release notes for a comprehensive overview of changes in this release.


Playback, MediaSession and UI

ExoPlayer now supports HLS interstitials for ad insertion in HLS streams. To play these ads using ExoPlayer’s built-in playlist support, pass an HlsInterstitialsAdsLoader.AdsMediaSourceFactory as the media source factory when creating the player. For more information see the official documentation.

This release also includes experimental support for ‘pre-warming’ decoders. Without pre-warming, transitions from one playlist item to the next may not be seamless in some cases, for example, we may need to switch codecs, or decode some video frames to reach the start position of the new media item. With pre-warming enabled, a secondary video renderer can start decoding the new media item earlier, giving near-seamless transitions. You can try this feature out by enabling it on the DefaultRenderersFactory. We’re actively working on further improvements to the way we interact with decoders, including adding a ‘fast seeking mode’ so stay tuned for updates in this area.

Media3 1.6.0 introduces a new media3-ui-compose module that contains functionality for building Compose UIs for playback. You can find a reference implementation in the Media3 Compose demo and learn more in Getting started with Compose-based UI. At this point we’re providing a first set of foundational state classes that link to the Player, in addition to some basic composable building blocks. You can use these to build your own customized UI widgets. We plan to publish default Material-themed composables in a later release.

Some other improvements in this release include: moving system calls off the application’s main thread to the background (which should reduce ANRs), a new decoder module wrapping libmpegh (for bundling object-based audio decoding in your app), and a fix for the Cast extension for apps targeting API 34+. There are also fixes across MPEG-TS and WebVTT extraction, DRM, downloading/caching, MediaSession and more.

Media extraction and frame retrieval

The new MediaExtractorCompat is a drop-in replacement for the framework MediaExtractor but implemented using Media3’s extractors. If you’re using the Android framework MediaExtractor, consider migrating to get consistent behavior across devices and reduce crashes.

We’ve also added experimental support for retrieving video frames in a new class ExperimentalFrameExtractor, which can act as a replacement for the MediaMetadataRetriever getFrameAtTime methods. There are a few benefits over the framework implementation: HDR input is supported (by default tonemapping down to SDR, but with the option to produce HLG bitmaps from Android 14 onwards), Media3 effects can be applied (including Presentation to scale the output to a desired size) and it runs faster on some devices due to moving color space conversion to the GPU. Here’s an example of using the new API:

val bitmap =
    withContext(Dispatchers.IO) {
        val configuration =
            ExperimentalFrameExtractor.Configuration
                .Builder()
                .setExtractHdrFrames(true)
                .build()
        val frameExtractor =
            ExperimentalFrameExtractor(
                context,
                configuration,
            )

        frameExtractor.setMediaItem(mediaItem, /*effects*/ listOf())

        val frame = frameExtractor.getFrame(timestamps).await()
        frameExtractor.release()
        frame.bitmap
    }

Editing, transcoding and export

Media3 1.6.0 includes performance, stability and functional improvements in Transformer. Highlights include: support for transcoding/transmuxing Dolby Vision streams on devices that support this format and a new MediaProjectionAssetLoader for recording from the screen, which you can try out in the Transformer demo app.

Check out Common media processing operations with Jetpack Media3 Transformer for some code snippets showing how to process media with Transformer, and tips to reduce latency.

This release also includes a new Kotlin-based demo app showcasing Media3’s video effects framework. You can select from a variety of video effects and preview them via ExoPlayer.setVideoEffects.

Animation showing contrast adjustment and a confetti effect in the new demo app

Get started sith Media3 1.6.0

Please get in touch via the Media3 issue Tracker if you run into any bugs, or if you have questions or feature requests. We look forward to hearing from you!



Source link

Washington Digital News

Share
Published by
Washington Digital News

Recent Posts

Warby Parker Seemingly Spilled The Beans On Google’s Android XR Smart Glasses Launch

"Intelligent Eyewear" is apparently only a week away. Warby Parker Warby…

21 minutes ago

The ‘Musk selloff’ deepens as Tesla and SpaceX combine for $450 billion two-day wipeout

Investors worry a divided Washington could derail “Elon, Inc.” Source link

35 minutes ago

Some Costs Facing Households, since 2024: Consumer Items, Housing, Health Premiums

Note that CPI growth accelerates post tariffs, but most profoundly, post-war. Health premiums under ACA…

36 minutes ago

Greece Approves 10% Crypto Capital Gains Tax

Greece’s parliament approved on Thursday a bill that imposes a 10% capital gains tax on…

1 hour ago

A cruise ship sold as a forever home left 203 residents in Cambodia as Iran war fuel costs hit

Florida-based Villa Vie Residences says fuel did it in. The company said its monthly fuel…

1 hour ago

OpenAI’s Dots are coming up against the price of privacy, and the price of compute

Welcome to Eye on AI. Beatrice Nolan here. In today’s issue: OpenAI took its Dev…

1 hour ago