mirror of
https://github.com/lizongying/my-tv.git
synced 2026-10-26 22:26:29 +08:00
change channel order
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -74,10 +74,9 @@ class PlayerFragment : Fragment() {
|
||||
@OptIn(UnstableApi::class)
|
||||
fun play(tvViewModel: TVViewModel) {
|
||||
this.tvViewModel = tvViewModel
|
||||
val videoUrlCurrent =
|
||||
tvViewModel.videoIndex.value?.let { tvViewModel.videoUrl.value?.get(it) }
|
||||
val videoUrlCurrent = tvViewModel.getVideoUrlCurrent()
|
||||
playerView?.player?.run {
|
||||
videoUrlCurrent?.let { setMediaItem(MediaItem.fromUri(it)) }
|
||||
setMediaItem(MediaItem.fromUri(videoUrlCurrent))
|
||||
prepare()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,8 +196,6 @@ object TVList {
|
||||
private fun setupTV(): Map<String, List<TV>> {
|
||||
val tvs = """
|
||||
央视频道
|
||||
CCTV4K 超高清,
|
||||
CCTV8K 超高清,
|
||||
CCTV1 综合,http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226231/index.m3u8
|
||||
CCTV2 财经,http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226195/index.m3u8
|
||||
CCTV3 综艺,http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226397/index.m3u8
|
||||
@@ -216,6 +214,8 @@ CCTV14 少儿,http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226193/inde
|
||||
CCTV15 音乐,http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225785/index.m3u8
|
||||
CCTV16 奥林匹克,http://39.134.24.162/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226921/index.m3u8;http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226921/index.m3u8
|
||||
CCTV17 农业农村,http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226198/index.m3u8
|
||||
CCTV4K 超高清,
|
||||
CCTV8K 超高清,
|
||||
风云剧场,http://dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226950/index.m3u8
|
||||
第一剧场,http://dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226959/index.m3u8
|
||||
怀旧剧场,http://dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226972/index.m3u8
|
||||
|
||||
@@ -222,18 +222,25 @@ class TVViewModel(private var tv: TV) : ViewModel() {
|
||||
mMinimumLoadableRetryCount = minimumLoadableRetryCount
|
||||
}
|
||||
|
||||
/**
|
||||
* (playerView?.player as ExoPlayer).setMediaSource(tvViewModel.buildSource())
|
||||
*/
|
||||
@OptIn(UnstableApi::class)
|
||||
fun buildSource(videoUrl: String, mHeaders: Map<String, String>?): HlsMediaSource {
|
||||
fun buildSource(): HlsMediaSource {
|
||||
val httpDataSource = DefaultHttpDataSource.Factory()
|
||||
mHeaders?.let { httpDataSource.setDefaultRequestProperties(it) }
|
||||
|
||||
return HlsMediaSource.Factory(httpDataSource).createMediaSource(
|
||||
MediaItem.fromUri(
|
||||
Uri.parse(videoUrl)
|
||||
Uri.parse(getVideoUrlCurrent())
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun getVideoUrlCurrent(): String {
|
||||
return _videoUrl.value!![_videoIndex.value!!]
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "TVViewModel"
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '8.2.0' apply false
|
||||
id 'com.android.library' version '8.2.0' apply false
|
||||
id 'com.android.application' version '8.2.1' apply false
|
||||
id 'com.android.library' version '8.2.1' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.9.21' apply false
|
||||
}
|
||||
Reference in New Issue
Block a user