Reputation: 1
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("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4") // Replace with your video URL
}
private fun playVideo(url: String) {
val media = Media(libVLC, Uri.parse("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.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()
}
}
Upvotes: 0
Views: 35