1+ /*
2+ * Copyright 2025 The Android Open Source Project
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
117package com.example.snippets
218
3- import androidx.media3.common.C
4- import androidx.media3.exoplayer.source.preload.TargetPreloadStatusControl
519import android.os.Bundle
620import androidx.annotation.OptIn
721import androidx.appcompat.app.AppCompatActivity
22+ import androidx.media3.common.C
823import androidx.media3.common.MediaItem
924import androidx.media3.common.util.UnstableApi
1025import androidx.media3.exoplayer.ExoPlayer
1126import androidx.media3.exoplayer.source.preload.DefaultPreloadManager
27+ import androidx.media3.exoplayer.source.preload.TargetPreloadStatusControl
1228import java.lang.Math.abs
1329
14-
1530// constants to make the code snippets work
1631const val currentPlayingIndex = 10
1732
@@ -71,7 +86,6 @@ class PreloadManagerSnippetsKotlin {
7186 // [START android_defaultpreloadmanager_invalidate]
7287 preloadManager.invalidate()
7388 // [END android_defaultpreloadmanager_invalidate]
74-
7589 }
7690
7791 @OptIn(UnstableApi ::class )
@@ -103,7 +117,6 @@ class PreloadManagerSnippetsKotlin {
103117 // [START android_defaultpreloadmanager_removeItem]
104118 preloadManager.remove(mediaItem)
105119 // [END android_defaultpreloadmanager_removeItem]
106-
107120 }
108121
109122 @OptIn(UnstableApi ::class )
@@ -118,6 +131,4 @@ class PreloadManagerSnippetsKotlin {
118131 return listOf ()
119132 }
120133 }
121-
122-
123134}
0 commit comments