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
+
1
17
package com.example.snippets
2
18
3
- import androidx.media3.common.C
4
- import androidx.media3.exoplayer.source.preload.TargetPreloadStatusControl
5
19
import android.os.Bundle
6
20
import androidx.annotation.OptIn
7
21
import androidx.appcompat.app.AppCompatActivity
22
+ import androidx.media3.common.C
8
23
import androidx.media3.common.MediaItem
9
24
import androidx.media3.common.util.UnstableApi
10
25
import androidx.media3.exoplayer.ExoPlayer
11
26
import androidx.media3.exoplayer.source.preload.DefaultPreloadManager
27
+ import androidx.media3.exoplayer.source.preload.TargetPreloadStatusControl
12
28
import java.lang.Math.abs
13
29
14
-
15
30
// constants to make the code snippets work
16
31
const val currentPlayingIndex = 10
17
32
@@ -71,7 +86,6 @@ class PreloadManagerSnippetsKotlin {
71
86
// [START android_defaultpreloadmanager_invalidate]
72
87
preloadManager.invalidate()
73
88
// [END android_defaultpreloadmanager_invalidate]
74
-
75
89
}
76
90
77
91
@OptIn(UnstableApi ::class )
@@ -103,7 +117,6 @@ class PreloadManagerSnippetsKotlin {
103
117
// [START android_defaultpreloadmanager_removeItem]
104
118
preloadManager.remove(mediaItem)
105
119
// [END android_defaultpreloadmanager_removeItem]
106
-
107
120
}
108
121
109
122
@OptIn(UnstableApi ::class )
@@ -118,6 +131,4 @@ class PreloadManagerSnippetsKotlin {
118
131
return listOf ()
119
132
}
120
133
}
121
-
122
-
123
134
}
0 commit comments