最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

vlc - How to programmatically rotate the libvlc by 45 degrees on Android? - Stack Overflow

programmeradmin0浏览0评论

I am trying to rotate the VLC player programmatically, but it is not working for me. The video layout is rotated, but the video itself is not rotating.

Why is the VLC player not rotating programmatically?

Is there any solution available to rotate a VLC video by 45 degrees?

I tried different versions of the LibVLC player, both old and new. I also tried rendering the video using SurfaceView and TextureView, but I have not found any solution yet.

code:

class MainActivity : AppCompatActivity() {

    private lateinit var libVLC: LibVLC
    private lateinit var mediaPlayer: MediaPlayer
    private lateinit var videoLayout: VLCVideoLayout

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        videoLayout = findViewById(R.id.videoLayout)
        // Initialize LibVLC
        libVLC = LibVLC(this, arrayListOf("--video-on-top", "--video-filter=transform","--transform-type=45"))
        mediaPlayer = MediaPlayer(libVLC)

        // Attach the video layout
        mediaPlayer.attachViews(videoLayout, null, false, false)

        // Set up play button
        playVideo(".mp4") // Replace with your video URL
    }

    private fun playVideo(url: String) {
        val media = Media(libVLC, Uri.parse(".mp4"))
        media.setHWDecoderEnabled(true, false) // Enable hardware acceleration
        mediaPlayer.media = media
        mediaPlayer.play()
    }

    override fun onDestroy() {
        super.onDestroy()
        mediaPlayer.stop()
        mediaPlayer.detachViews()
        mediaPlayer.release()
        libVLC.release()
    }
}
发布评论

评论列表(0)

  1. 暂无评论