[VB.NET] Windows Media Player


Description
      this tutorial i will show how to add windows media player into the form (vb.net), and get the source of media , and how to repeat forever the player.


HowTo
     1. Open your project VB.NET , click on the toolbox icon on the left, after the toolbox appeared right click on the area of toolbox and click choose item.



     2. Select COM Component and choose "Windows Media Player"




     3. A new item will appear in the toolbox, now drag it to the form and give name myplayer. Until now you success add player to the form. now we need the path of source the media for example zzz.wmv and location in the D:\.

     4. to add path just add this code in the form load : 
      myplayer.URL= "D:\zzz.wmv"
      if you have dynamic path maybe you can use this : 
      myplayer.URL = My.Application.Info.DirectoryPath & "zzz.wmv"

      another control :
      myplayer.ctlcontrols.play()
      myplayer.ctlcontrols.stop()

     5. Now Run it, the video will be playing :), but some case we need playing repeatly forever. to looping forever use this syntax on form load or whatever :
        myplayer.settings.setMode("loop", True)

     6. Done, you video will play forever.

Post a Comment

Harap gunakan bahasa yang baik dan sopan, terima kasih