|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IntroductionPlaying Media isn't hard (at least not in Visual Basic). This tutorial will teach you how to create a fully functional general media player for any use by using the BeginFirst, you must insert a
Not only are there "Play, Pause and Stop" controls, but there are also "Volume, Balance and Track" controls. The interesting part is the DurationDim CurPos As Integer = Convert.ToInt32(PlayerControl.Ctlcontrols.currentPosition * 1000) 'milliseconds Dim DurationVar As Integer = Convert.ToInt32(PlayerControl.currentMedia.duration * 1000) 'milliseconds If DurationVar > 0 Then PlayBar.Value = Convert.ToInt32((CurPos * 100) / DurationVar) '% complete End If 'Update the time label Duration.Text = PlayerControl.Ctlcontrols.currentPositionString Track BarTry If (PlayerControl.currentMedia.duration <> 0) Then Dim NewPerc As Double = Convert.ToDouble(PlayBar.Value) / 100 Dim DurationVar As Integer = Convert.ToInt32(PlayerControl.currentMedia.duration * 1000) 'milliseconds Dim NewPos As Integer = (DurationVar * NewPerc) / 1000 PlayerControl.Ctlcontrols.currentPosition = NewPos Else PlayBar.Value = 0 End If Catch ex As Exception MsgBox(ex.Message) End Try Now there are a few PlayerControl.settings.autoStart = True PlayerControl.settings.volume = VolumeBar.Value PlayerControl.settings.balance = BalanceBar.Value PlayerControl.settings.enableErrorDialogs = False PlayerControl.enableContextMenu = False Points of InterestWell, that about wraps it up. Remember that when you add a
|
||||||||||||||||||||||