i have 2 forms (form1) and (form2), form2 has media player and combobox to choose video this is the code:
Public Class Form2
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedItem = "Video 1" Then
On Error Resume Next
IO.File.WriteAllBytes(IO.Path.GetTempPath & "\Video 1.mp4", My.Resources.Video_2)
AxWindowsMediaPlayer1.URL = IO.Path.GetTempPath & "\Video 1.mp4"
IO.File.Delete(IO.Path.GetTempPath & "\Video 1.mp4")
End If
If ComboBox1.SelectedItem = "Video 2" Then
On Error Resume Next
IO.File.WriteAllBytes(IO.Path.GetTempPath & "\Video 2.mp4", My.Resources.Video_2)
AxWindowsMediaPlayer1.URL = IO.Path.GetTempPath & "\Video 2.mp4"
IO.File.Delete(IO.Path.GetTempPath & "\Video 2.mp4")
End If
If ComboBox1.SelectedItem = "Video 3" Then
On Error Resume Next
IO.File.WriteAllBytes(IO.Path.GetTempPath & "\Video 3.mp4", My.Resources.Video_3)
AxWindowsMediaPlayer1.URL = IO.Path.GetTempPath & "\Video 3.mp4"
IO.File.Delete(IO.Path.GetTempPath & "\Video 3.mp4")
End If
End Sub
End Class
this code works fine until i changed (form1) to be parent and (form2) to be child with this code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Form2.StartPosition = FormStartPosition.Manual
Form2.Left = 105
Form2.Top = 50
Form2.MdiParent = Me
End Sub
video isn't viewed right (only part of it) as if the video is larger than media player screen also full screen mode isn't working at all. this is another trial with no progress:
If ComboBox1.SelectedItem = "Video 1" Then
Dim b As Byte() = My.Resources.Video_1
Dim TheFIlePath As String = "Video 1.mp4"
Dim TempFile As IO.FileStream = IO.File.Create(TheFIlePath)
TempFile.Write(b, 0, b.Length)
TempFile.Close()
AxWindowsMediaPlayer1.URL = (TheFIlePath)
End If
i tried both true and false for stretchtofit also tried with (Try and Catch exception) like this:
If ComboBox1.SelectedItem = "Video 1" Then
Try
AxWindowsMediaPlayer1.URL = "D:\40.mp4"
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
with no success, this is the video screenshot when it is playing well:
After a lot of search, i found that windows media player cannot be played full screen in mdi child form.
so instead of using mdi child form, i replaced it with a panel and AxWindowsMediaPlayer was added, the fullscreen property is now working fine and the video is scaled fine.