GithubHelp home page GithubHelp logo

Comments (2)

CarGuo avatar CarGuo commented on July 23, 2024

Option ijkapplication not found. 不是错误,可以配置下文档的 tcp 看看

from gsyvideoplayer.

ifnk avatar ifnk commented on July 23, 2024

Option ijkapplication not found. 不是错误,可以配置下文档的 tcp 看看

哇, 可以 了, 现在能播了, 谢谢作者
这是我的 mainActivity代码

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView
import com.example.myapplication.ui.theme.MyApplicationTheme
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.shuyu.gsyvideoplayer.model.VideoOptionModel
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import tv.danmaku.ijk.media.player.IjkMediaPlayer


class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            MyApplicationTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {
                    GSYVideoPlayerView(
                        Modifier.fillMaxSize(),
                        "rtsp://admin:[email protected]:554/Streaming/Channels/101"
                    )
                }
            }
        }
    }
}

@Composable
fun GSYVideoPlayerView(modifier: Modifier = Modifier, videoUrl: String) {
    AndroidView(
        modifier = modifier,
        factory = { context ->
            val videoOptionModel =
                VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtsp_transport", "tcp")
            val list: MutableList<VideoOptionModel> = ArrayList()
            list.add(videoOptionModel)
            GSYVideoManager.instance().optionModelList = list;

            StandardGSYVideoPlayer(context).apply {
                setUp(videoUrl, true, "测试视频")
                startPlayLogic()
            }
        },
        update = { player ->
            player.setUp(videoUrl, true, "测试视频")
            player.startPlayLogic()
        }
    )
}

是加了这几行 就可以 了

           val videoOptionModel =
               VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtsp_transport", "tcp")
           val list: MutableList<VideoOptionModel> = ArrayList()
           list.add(videoOptionModel)
           GSYVideoManager.instance().optionModelList = list;

参考文档是这个 https://github.com/CarGuo/GSYVideoPlayer/blob/master/doc/QUESTION.md 第17 条

from gsyvideoplayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.