简体   繁体   中英

VB.NET .Net 6.0 Videoplayer

Can someone tell me how to embedd a simple (video) mediaplayer in VB.NET? .Net 6.0 (in vs2022) does not seem to support a mediaplayer.

Thanks

First u add VLC or media player object, here i post how to add media player in tool and how to play simple video files.

By default, 'Windows Media Player' control is not provided in the Toolbox, we have to add it into the toolbox if required. Inorder to add 'Windows Media Player' control into toolbox

Right click on 'General' tab (or anyother tab) in toolbox ->select 'Choose Items...' ->select 'COM Components' tab ->select 'Windows Media Player' ->click on 'OK' button.

Once u add media player, control will appear in VS tool bar, and from that u drag to ur form design.

Below the code to play video and audio files.

    Imports System
    Imports System.Windows.Forms

    Namespace mymediaplayer Public Partial Class Form1
    Inherits Form

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub btnBrowse_Click(ByVal sender As Object, ByVal e As EventArgs)
        openFileDialog1.Filter = "(mp3,wav,mp4,mov,wmv,mpg)|*.mp3;*.wav;*.mp4;*.mov;*.wmv;*.mpg|all files|*.*"
        If openFileDialog1.ShowDialog() = DialogResult.OK Then axWindowsMediaPlayer1.URL = openFileDialog1.FileName
    End Sub
End Class
   End Namespace

Thanks and Regards Aravind

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM