-
Notifications
You must be signed in to change notification settings - Fork 248
Add PreloadManager snippets, and update media3 to 1.8.0 #574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Adding snippets to support new PreloadManager docs. That requires bumping the Media3 version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3 version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3 version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3 version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3 version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3 version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3 version up to 1.8.0.
Here is the summary of changes. You are about to add 7 region tags.
This comment is generated by snippet-bot.
|
Adding snippets to support new PreloadManager docs. That requires bumping the Media3 version up to 1.8.0.
gradle/libs.versions.toml
Outdated
@@ -187,6 +189,8 @@ play-services-wearable = { module = "com.google.android.gms:play-services-wearab | |||
validator-push = { module = "com.google.android.wearable.watchface.validator:validator-push", version.ref = "validatorPush" } | |||
wear-compose-material = { module = "androidx.wear.compose:compose-material", version.ref = "wearComposeMaterial" } | |||
wear-compose-material3 = { module = "androidx.wear.compose:compose-material3", version.ref = "wearComposeMaterial3" } | |||
androidx-media3-common-ktx = { group = "androidx.media3", name = "media3-common-ktx", version.ref = "media3CommonKtx" } | |||
media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3Exoplayer" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep naming convention as same ? Eg change to "androidx-media3-exoplayer"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting that! I'd just accepted Android Studio's proposed fix, but in fact, we already include Media3 common & exoplayer at lines 136-7 -- I just needed to update the version number (to 1.8.0) and add those labels to the dependencies. PTAL!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added one minor comment. LGTM otherwise
// [START android_defaultpreloadmanager_getAndPlayMedia] | ||
// When a media item is about to display on the screen | ||
val mediaSource = preloadManager.getMediaSource(mediaItem) | ||
if (mediaSource != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we change the L101-103 to
if (mediaSource != null) {
player.setMediaSource(mediaSource)
} else {
// If the mediaItem hasn't been added to the preload manager yet,
// set it directly to the player when it's about to play
player.setMediaItem(mediaItem)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Yes, that was a quick cleanup just to get it to compile -- this version makes it a better example.
I changed the comment slightly, PTAL.
Submitting doc snippets used for the new PreloadManager documentation. Had to bump the Media3 version up to 1.8.0 for some of the new APIs in that doc.
Once we've submitted this in Github, I'll update my docs to pull the code snippets in from there.