I have used this code from another thread to view a video.
Does anyone know how to break the aspect ratio so that the video stretches to full form width and height?
I have tried to change fitheight and fitwidth of the mediaview to form width and height but the video maintains its ratio.
Appreciate any help that can be given.
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim mp As MediaPlayer
Dim mv As MediaView
Dim msgbox As Msgboxes
End Sub
Sub AppStart (Form1 As Form, Args() As String)
msgbox.Show("put test.mp4 beside me(under objects)","info")
MainForm = Form1
MainForm.Title="play mp4 video"
MainForm.SetFormStyle("UNDECORATED")'no win title
MainForm.WindowLeft=0
MainForm.WindowTop=0
MainForm.WindowHeight=fx.PrimaryScreen.MaxY
MainForm.WindowWidth=fx.PrimaryScreen.MaxX
mp.Initialize("mp",File.geturi(File.DirApp,"test.mp4"))
mv.init("mv",MainForm.RootPane,mp)
MainForm.Show
End Sub
Sub mv_onready
Dim videowidth,videoheight As Double
videowidth=mv.MediaInfo.width
videoheight=mv.MediaInfo.height
Log("media size:"&videoheight&"-"&videowidth)
mv.FitHeight=videoheight
mv.FitWidth=videowidth
mp.Play
End Sub
Sub mp_Complete
msgbox.Show("play completed!","Tips")
End Sub
Does anyone know how to break the aspect ratio so that the video stretches to full form width and height?
I have tried to change fitheight and fitwidth of the mediaview to form width and height but the video maintains its ratio.
Appreciate any help that can be given.