optimize
This commit is contained in:
parent
3109a61bcf
commit
7821e8fa58
|
|
@ -100,10 +100,13 @@ dependencies {
|
||||||
// For HLS playback support with ExoPlayer
|
// For HLS playback support with ExoPlayer
|
||||||
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
|
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
|
||||||
|
|
||||||
|
// 21:2.9.0 17:2.6.4
|
||||||
|
def retrofit2_version = "2.9.0"
|
||||||
|
|
||||||
implementation 'com.google.protobuf:protobuf-kotlin:3.25.1'
|
implementation 'com.google.protobuf:protobuf-kotlin:3.25.1'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
implementation "com.squareup.retrofit2:converter-gson:$retrofit2_version"
|
||||||
implementation 'com.squareup.retrofit2:converter-protobuf:2.9.0'
|
implementation "com.squareup.retrofit2:converter-protobuf:$retrofit2_version"
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2"
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2"
|
||||||
implementation 'androidx.core:core-ktx:1.11.0-beta02'
|
implementation 'androidx.core:core-ktx:1.11.0-beta02'
|
||||||
implementation 'androidx.leanback:leanback:1.2.0-alpha02'
|
implementation 'androidx.leanback:leanback:1.2.0-alpha02'
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ class PlayerFragment : Fragment() {
|
||||||
private var _binding: PlayerBinding? = null
|
private var _binding: PlayerBinding? = null
|
||||||
private var playerView: PlayerView? = null
|
private var playerView: PlayerView? = null
|
||||||
private var tvViewModel: TVViewModel? = null
|
private var tvViewModel: TVViewModel? = null
|
||||||
|
private val aspectRatio = 16f / 9f
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
|
@ -43,10 +44,9 @@ class PlayerFragment : Fragment() {
|
||||||
playerView!!.player?.playWhenReady = true
|
playerView!!.player?.playWhenReady = true
|
||||||
playerView!!.player?.addListener(object : Player.Listener {
|
playerView!!.player?.addListener(object : Player.Listener {
|
||||||
override fun onVideoSizeChanged(videoSize: VideoSize) {
|
override fun onVideoSizeChanged(videoSize: VideoSize) {
|
||||||
val aspectRatio = 16f / 9f
|
|
||||||
val layoutParams = playerView?.layoutParams
|
|
||||||
val ratio = playerView?.measuredWidth?.div(playerView?.measuredHeight!!)
|
val ratio = playerView?.measuredWidth?.div(playerView?.measuredHeight!!)
|
||||||
if (ratio != null) {
|
if (ratio != null) {
|
||||||
|
val layoutParams = playerView?.layoutParams
|
||||||
if (ratio < aspectRatio) {
|
if (ratio < aspectRatio) {
|
||||||
layoutParams?.height =
|
layoutParams?.height =
|
||||||
(playerView?.measuredWidth?.div(aspectRatio))?.toInt()
|
(playerView?.measuredWidth?.div(aspectRatio))?.toInt()
|
||||||
|
|
|
||||||
|
|
@ -169,8 +169,7 @@ class Request {
|
||||||
.enqueue(object : Callback<Info> {
|
.enqueue(object : Callback<Info> {
|
||||||
override fun onResponse(call: Call<Info>, response: Response<Info>) {
|
override fun onResponse(call: Call<Info>, response: Response<Info>) {
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
val info = response.body()
|
val token = response.body()?.data?.token
|
||||||
val token = info?.data?.token
|
|
||||||
Log.i(TAG, "info success $token")
|
Log.i(TAG, "info success $token")
|
||||||
val cookie =
|
val cookie =
|
||||||
"guid=1; vplatform=109; yspopenid=vu0-8lgGV2LW9QjDeuBFsX8yMnzs37Q3_HZF6XyVDpGR_I; vusession=$token"
|
"guid=1; vplatform=109; yspopenid=vu0-8lgGV2LW9QjDeuBFsX8yMnzs37Q3_HZF6XyVDpGR_I; vusession=$token"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.lizongying.mytv.models
|
package com.lizongying.mytv.models
|
||||||
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue