|
@@ -32,11 +32,11 @@ 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
|
36
|
35
|
import fr.forum_thalie.tsumugi.alarm.RadioAlarm
|
37
|
36
|
import fr.forum_thalie.tsumugi.alarm.RadioSleeper
|
38
|
37
|
import fr.forum_thalie.tsumugi.playerstore.PlayerStore
|
39
|
38
|
import java.util.*
|
|
39
|
+import kotlin.collections.ArrayList
|
40
|
40
|
import kotlin.math.exp
|
41
|
41
|
import kotlin.math.ln
|
42
|
42
|
import kotlin.system.exitProcess
|
|
@@ -348,7 +348,10 @@ class RadioService : MediaBrowserServiceCompat() {
|
348
|
348
|
setBufferDurationsMs(minBufferMillis, maxBufferMillis, bufferForPlayback, bufferForPlaybackAfterRebuffer)
|
349
|
349
|
}.createDefaultLoadControl()
|
350
|
350
|
|
351
|
|
- player = ExoPlayerFactory.newSimpleInstance(this, DefaultTrackSelector(), loadControl)
|
|
351
|
+ val playerBuilder = SimpleExoPlayer.Builder(this)
|
|
352
|
+ playerBuilder.setLoadControl(loadControl)
|
|
353
|
+ player = playerBuilder.build()
|
|
354
|
+
|
352
|
355
|
player.addMetadataOutput {
|
353
|
356
|
for (i in 0 until it.length()) {
|
354
|
357
|
val entry = it.get(i)
|
|
@@ -356,9 +359,19 @@ class RadioService : MediaBrowserServiceCompat() {
|
356
|
359
|
Log.d(tag, radioTag + "onMetadata: IcyHeaders $entry")
|
357
|
360
|
}
|
358
|
361
|
if (entry is IcyInfo) {
|
359
|
|
- Log.d(tag, radioTag + "onMetadata: Title ----> ${entry.title}")
|
|
362
|
+ Log.e(tag, radioTag + "onMetadata: Title ----> ${entry.title}")
|
360
|
363
|
// Note : Kotlin supports UTF-8 by default.
|
361
|
364
|
numberOfSongs++
|
|
365
|
+ val s = entry.title!!
|
|
366
|
+ val a = ArrayList<Int>()
|
|
367
|
+
|
|
368
|
+ for (j in s.indices)
|
|
369
|
+ {
|
|
370
|
+ a.add(s[j].toInt())
|
|
371
|
+
|
|
372
|
+ }
|
|
373
|
+ Log.e(tag, a.toString())
|
|
374
|
+ Log.e(tag, "raw: ${it}")
|
362
|
375
|
val data = entry.title!!
|
363
|
376
|
PlayerStore.instance.currentSong.setTitleArtist(data)
|
364
|
377
|
}
|