浏览代码

switched to local exoplayer using branch dev-v2

yattoz 5 年前
父节点
当前提交
36a3e9046d

+ 3 - 0
.gitmodules 查看文件

@@ -0,0 +1,3 @@
1
+[submodule "ExoPlayer"]
2
+	path = ExoPlayer
3
+	url = https://github.com/google/ExoPlayer/

+ 22 - 0
.idea/gradle.xml 查看文件

@@ -8,6 +8,28 @@
8 8
         <option name="modules">
9 9
           <set>
10 10
             <option value="$PROJECT_DIR$" />
11
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/av1" />
12
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/cast" />
13
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/cronet" />
14
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/ffmpeg" />
15
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/flac" />
16
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/gvr" />
17
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/ima" />
18
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/jobdispatcher" />
19
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/leanback" />
20
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/mediasession" />
21
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/okhttp" />
22
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/opus" />
23
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/rtmp" />
24
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/vp9" />
25
+            <option value="$PROJECT_DIR$/ExoPlayer/extensions/workmanager" />
26
+            <option value="$PROJECT_DIR$/ExoPlayer/library/all" />
27
+            <option value="$PROJECT_DIR$/ExoPlayer/library/core" />
28
+            <option value="$PROJECT_DIR$/ExoPlayer/library/dash" />
29
+            <option value="$PROJECT_DIR$/ExoPlayer/library/hls" />
30
+            <option value="$PROJECT_DIR$/ExoPlayer/library/smoothstreaming" />
31
+            <option value="$PROJECT_DIR$/ExoPlayer/library/ui" />
32
+            <option value="$PROJECT_DIR$/ExoPlayer/testutils" />
11 33
             <option value="$PROJECT_DIR$/app" />
12 34
           </set>
13 35
         </option>

+ 1 - 0
.idea/vcs.xml 查看文件

@@ -2,5 +2,6 @@
2 2
 <project version="4">
3 3
   <component name="VcsDirectoryMappings">
4 4
     <mapping directory="" vcs="Git" />
5
+    <mapping directory="$PROJECT_DIR$/ExoPlayer" vcs="Git" />
5 6
   </component>
6 7
 </project>

+ 1 - 0
ExoPlayer

@@ -0,0 +1 @@
1
+Subproject commit 24a19264dbf35e326bbd7bb36c232eb180e1e26d

+ 3 - 1
app/build.gradle 查看文件

@@ -65,7 +65,9 @@ dependencies {
65 65
      */
66 66
 
67 67
     implementation "androidx.media:media:1.1.0"
68
-    implementation 'com.google.android.exoplayer:exoplayer:2.11.0'
68
+    //implementation 'com.google.android.exoplayer:exoplayer:2.11.1'
69
+    implementation project(':exoplayer-library') // uses local ExoPlayer clone, from dev-v2 branch (fixes ISO-8859-1 ICY metadata
70
+
69 71
     implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
70 72
     implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
71 73
 

二进制
app/debug/app-debug.apk 查看文件


+ 1 - 0
app/debug/output.json 查看文件

@@ -0,0 +1 @@
1
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":2,"versionName":"1.1dev","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}]

二进制
app/release/app-release.apk 查看文件


+ 1 - 0
app/release/output.json 查看文件

@@ -0,0 +1 @@
1
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":2,"versionName":"1.1dev","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

+ 5 - 0
app/src/main/java/fr/forum_thalie/tsumugi/RadioService.kt 查看文件

@@ -32,6 +32,7 @@ import androidx.media.AudioManagerCompat
32 32
 import androidx.preference.PreferenceManager
33 33
 import com.google.android.exoplayer2.*
34 34
 import com.google.android.exoplayer2.metadata.icy.*
35
+import com.google.android.exoplayer2.trackselection.DefaultTrackSelector
35 36
 import fr.forum_thalie.tsumugi.alarm.RadioAlarm
36 37
 import fr.forum_thalie.tsumugi.alarm.RadioSleeper
37 38
 import fr.forum_thalie.tsumugi.planning.Planning
@@ -350,9 +351,13 @@ class RadioService : MediaBrowserServiceCompat() {
350 351
             setBufferDurationsMs(minBufferMillis, maxBufferMillis, bufferForPlayback, bufferForPlaybackAfterRebuffer)
351 352
         }.createDefaultLoadControl()
352 353
 
354
+        /*
353 355
         val playerBuilder = SimpleExoPlayer.Builder(this)
354 356
         playerBuilder.setLoadControl(loadControl)
355 357
         player = playerBuilder.build()
358
+        */
359
+
360
+        player = ExoPlayerFactory.newSimpleInstance(this, DefaultTrackSelector(), loadControl)
356 361
 
357 362
         player.addMetadataOutput {
358 363
             for (i in 0 until it.length()) {

+ 1 - 1
app/src/main/java/fr/forum_thalie/tsumugi/ui/news/NewsAdapter.kt 查看文件

@@ -134,7 +134,7 @@ class NewsAdapter(private val dataSet: ArrayList<News>, private val c: Context
134 134
             HtmlCompat.FROM_HTML_MODE_LEGACY,
135 135
             ImageGetter { source ->
136 136
                 val d = LevelListDrawable()
137
-                val empty: Drawable? = ContextCompat.getDrawable(c, R.drawable.exo_icon_circular_play)
137
+                val empty: Drawable? = ContextCompat.getDrawable(c, R.drawable.exo_icon_play)
138 138
 
139 139
                 d.addLevel(0, 0, empty!!)
140 140
                 d.setBounds(0, 0, empty.intrinsicWidth, empty.intrinsicHeight)

+ 4 - 0
settings.gradle 查看文件

@@ -1,2 +1,6 @@
1 1
 include ':app'
2 2
 rootProject.name='Tsumugi-app'
3
+
4
+gradle.ext.exoplayerRoot = './ExoPlayer'
5
+gradle.ext.exoplayerModulePrefix = 'exoplayer-'
6
+apply from: new File(gradle.ext.exoplayerRoot, 'core_settings.gradle')