This commit is contained in:
Li ZongYing
2024-01-11 15:19:57 +08:00
parent 3109a61bcf
commit 7821e8fa58
4 changed files with 9 additions and 8 deletions
@@ -24,6 +24,7 @@ class PlayerFragment : Fragment() {
private var _binding: PlayerBinding? = null
private var playerView: PlayerView? = null
private var tvViewModel: TVViewModel? = null
private val aspectRatio = 16f / 9f
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
@@ -43,10 +44,9 @@ class PlayerFragment : Fragment() {
playerView!!.player?.playWhenReady = true
playerView!!.player?.addListener(object : Player.Listener {
override fun onVideoSizeChanged(videoSize: VideoSize) {
val aspectRatio = 16f / 9f
val layoutParams = playerView?.layoutParams
val ratio = playerView?.measuredWidth?.div(playerView?.measuredHeight!!)
if (ratio != null) {
val layoutParams = playerView?.layoutParams
if (ratio < aspectRatio) {
layoutParams?.height =
(playerView?.measuredWidth?.div(aspectRatio))?.toInt()
@@ -169,8 +169,7 @@ class Request {
.enqueue(object : Callback<Info> {
override fun onResponse(call: Call<Info>, response: Response<Info>) {
if (response.isSuccessful) {
val info = response.body()
val token = info?.data?.token
val token = response.body()?.data?.token
Log.i(TAG, "info success $token")
val cookie =
"guid=1; vplatform=109; yspopenid=vu0-8lgGV2LW9QjDeuBFsX8yMnzs37Q3_HZF6XyVDpGR_I; vusession=$token"
@@ -1,6 +1,5 @@
package com.lizongying.mytv.models
import android.content.SharedPreferences
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel