Results 1 to 5 of 5

Thread: How to make your own media player

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2022
    Posts
    31

    Exclamation How to make your own media player

    Hello, how can I make a media player in Visual Studio? That is not Windows Media Player or VLC, that is own. I have heard about MediaElement. How can I do it?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: How to make your own media player

    You've heard about MediaElement. Have you made any effort to research it to find out whether and how it might help you? If you want to write an application then you need to make some effort and do some work, not just sit back and wait to be told what to do.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2022
    Posts
    31

    Re: How to make your own media player

    Yes I do. In fact I have created one with the help of a GitHub repository, however, I don't know how to make it work concretely. Well, in WindowsMediaPlayer I use the following function to show an image or a video in my current player, being a viewer inside the app and an external one on a Second screen:

    Code:
    Dim SelectedFile(1)
        Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView1.SelectedIndexChanged
            Dim Rt As String = ""
            Dim N As String = ""
            If ListView1.SelectedIndices.Count <> 0 Then
                Dim i As Int16
                For Each i In ListView1.SelectedIndices
                    N = ListView1.Items(i).Text
                    Rt = ListView1.Items(i).SubItems(1).Text
                Next
                SelectedFile(0) = N
                SelectedFile(1) = Rt
            End If
        End Sub
        Private Sub ListView1_Click(sender As Object, e As EventArgs) Handles ListView1.Click
            If MaterialSwitch1.Checked = False Then
                Form2.AttendantZoom.URL = (SelectedFile(1))
                Form2.AttendantZoom.settings.volume = 100
                Form2.Button1.Visible = False
                Form2.Button2.Visible = False
                Form2.Button3.Visible = False
                Form2.Button4.Visible = False
                Form2.PictureBox2.Visible = False
                Form2.Button5.Visible = False
                Form2.Button6.Visible = False
    
                AxWindowsMediaPlayer1.Visible = True
                AxWindowsMediaPlayer1.URL = ((SelectedFile(1)))
                AxWindowsMediaPlayer1.settings.mute = True
                Panel5.Visible = True
                Panel5.Location = NewPoint(0, 0)
                Panel5.BackColor = Color.Black
                Panel10.Visible = True
                Button29.Visible = True
                Button28.Visible = True
                Button31.Visible = False
                Button30.Visible = False
                Button24.Visible = True
                Button25.Visible = True
                Label9.Visible = True
                Label36.Visible = True
                MetroTrackBar1.Visible = True
            else
                Form2.AttendantZoom.URL = Nothing
                Form2.AttendantZoom.settings.mute = True
                Form2.Button1.Visible = True
                Form2.Button2.Visible = True
                Form2.Button3.Visible = True
                Form2.Button4.Visible = True
                Form2.PictureBox2.Visible = True
                Form2.Button5.Visible = True
                Form2.Button6.Visible = True
    
                AxWindowsMediaPlayer1.Visible = True
                AxWindowsMediaPlayer1.URL = ((SelectedFile(1)))
                AxWindowsMediaPlayer1.settings.volume = 100
                Panel5.Visible = True
                Panel5.Location = NewPoint(0, 0)
                Panel5.BackColor = Color.Black
                Panel10.Visible = True
                Button29.Visible = True
                Button28.Visible = True
                Button31.Visible = False
                Button30.Visible = False
                Button24.Visible = True
                Button25.Visible = True
                Label9.Visible = True
                Label36.Visible = True
                MetroTrackBar1.Visible = True
            End If
    
            Timer4.Start()
        End Sub
    My question is, how can I replace AxWindowsMediaPlayer1 and AttendantZoom with my own player made with MediaElement? The intention is to power the Windows app on Linux and macOS.

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: How to make your own media player

    I'm not sure if MS have implemented any newer technology for a media player but I remember having this sample in the codebank that might give you a hint, if they are still using API.

    https://www.vbforums.com/showthread....p-media-player
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2022
    Posts
    31

    Re: How to make your own media player

    Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width