Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Stop/pause/play With Media Player


im using mediaplayer control in my vb.. when i use the code


VB Code:
wmPlayer.Controls.pause
and
VB Code:
wmPlayer.Controls.stop
and press the play, they work the same..

all i want to happen is when i pause, it resume the playing.. when i press stop, it totally stop the playing time..




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Play Pbc (play Back Control) Media Files In Windows Media Player
i can not play pbc (play back control) media files in windows media player in visual basic program and i try to play in normal windows media player on windows , it can not play too . help me pls , thanks a lot

Play, Stop, Pause, Loop Play MP-3
respected codeguru users and viewers,

how i can play mp3 file in my program i used mmcontrol and active movie control but not the solution due to lack of experience, can any one help me how its done, thanx for viewing and responsing,

Play A Media File With Windows Media Player Within The VB Form
I have insterted the windows media player components, and I want to play a file from my local disk in this object.

I tried "WindowsMediaPlayer1.openPlayer SearchingPath & List1" but the file open in a new window media player, not in the form.

Can you tell me how can I do that?

Best regards

Michael Sakellis
Athens-Greece

Play, Stop, Pause, Etc Buttons
Hi there i am trying to manage a number of video files using standard buttons:

Play
Stop
Pause
Skip Forward
Skip Back

I am having big problems!, i can see to get the video to start, but im not sure it is correct, it is using the DoVerb method.

Can anyone help me please?!?!?!?

Alex aka. VB Idiot

Media Player Pause (Wups, No Problem Here)
hi, im using media player control, version 6.4 blabla.... but once i use the

mediaplyer1.pause command

how do i make it resume..... not restart but resume?

thanks

Windows Media Player - Pause Movie To Get A Preview
Hi there,

I'm using a Windows Media Player 9 control and VB 6 to cretae a program.

I looked for help here on pausing a video clip at a specific time to get a preview of a video clip but no joy. I'm creating a movie browser where you can look at several movie clips and see info about the clips e.g. filename, duration, file path.

To preview the video clip, I placed the video window on the left and it has no controls (I disabled it). I'm trying to make the Windows Media Player control show what happens at 10 seconds into the video clip. It will like a static image of the clip, it would NOT play the first 9 seconds.

I'm having a difficult trying to make the video clip pause at 10 secs.

Below is what I wrote for the program. The Window Media Player control is named as wmpMDH and a form label named labMname just to show the file name.

Code:
Private Sub Form_Load()

   wmpMDH.URL = "C:justamovie.wmv"
   labMname.Caption = wmpMDH.currentMedia.Name

End Sub

This works so far and it plays the video clip when the form loads, that is the clip is set to "Autostart". However, I want to go forward to 10 seconds of the clip and pause it there.

I have found a property (currentmedia.getmarkertime) for the movie's time but it caused an error.

Code:
Private Sub Form_Load()

   wmpMDH.URL = "C:justamovie.wmv"
   labMname.Caption = wmpMDH.currentMedia.Name

   wmpMDH.currentMedia.getMarkerTime (10)

   wmpMDH.Controls.pause

End Sub

It said

"Run-Time Error 70

Permission Denied"

How can I set it to pause the video at 10 secs?

Can you please help me?

Jova

How To Play Wav In Media Player?
how to play wav in media player?

How To Play The Media Player Through Vb
hi guys,
we are in a project to play a media player through vb.
here we also wanna adjust the volume, equlizer, slow & speed the sound so and so i need help from you guys, to move on.

Play Media Without Media Player?
Is there a way to play a file, for example .wav, without using the MediaPlayer component?

How To Play The Media Player OCX By Using The Playlistcollection?
I am trying to play the media player OCX by using the playlistcollection, mediacollection etc. But wasn't able to play it. Does anyone have an idea as to how should I go about it.

Media Player (play Next Song)
im made a mp3 player using vb. What code should i add to make it play the next song automatically. this is my play button code:

Private Sub lbplay_Click()
If GetFromINI("compact mp3 player", "DIRECTORY", App.Path & "mp3.oca") = "" Then
Exit Sub
Else: End If
If File1.ListIndex = -1 Then
Exit Sub
Else
End If
If Form12.MediaPlayer1.PlayState = mpPlaying Then
Form12.MediaPlayer1.Stop
Form12.Timer1.Enabled = False
Form12.lbpause.Enabled = False
Form12.lbstop.Enabled = False
Form12.MediaPlayer1.Open File1.Path & "" & File1.filename
Timer1.Enabled = True
Form12.lbpause.Enabled = True
Form12.lbstop.Enabled = True
Else
Form12.MediaPlayer1.Open File1.Path & "" & File1.filename
Timer1.Enabled = True
Form12.lbpause.Enabled = True
Form12.lbstop.Enabled = True
End If



End Sub

How Can I Get The Media Player To Play Playlists?
i have a decent mp3 player based around the mediaplayer and want to import mutiselected files from a listview box into a playlist to play consecutively any ideas?

Resume Play With Media Player
Hello all,
I created a form in VB.net(2003) that has an embedded media player. Basically I have created all the controls as buttons on the form and I can't figure out how to resume play after I have pause the media file. Does any one know how to resume play of a song that was in play before pausing it or what property I can use to resume play?

Play A MP3 File Without Using Media Player
Hi there!!!

  Is there a way to play a MP3 file without Windows Media Player?, for example, with APIs?, I wanna have my own code. I don't want my program to depend on another program. Thanks!, see you!

Bye!!! Pol1
- trying to make the world graphically better -

Media Player Play Time Question
I'm using Media player (msdxm.ocx) To play audio that has it's data stored in a db file.

I am using data from this db to set the MediaPlayer1.SelectionStart and MediaPlayer1.SelectionEnd. Now what I am trying to do is have the Play time displayed. If i use this in a timer


Code:
Label1.Caption = Format$(TimeSerial(0, 0, MediaPlayer1.CurrentPosition), " h:mm:ss")

It works great if I am not using MediaPlayer1.SelectionStart. When using MediaPlayer1.SelectionStart the count jumps to whatever MediaPlayer1.SelectionStart is. So even though the real play time is say 10 seconds, 12 seconds is displayed.

I thought I would be able to do this (ok this works now I had a type-o)


Code:
test = MediaPlayer1.CurrentPosition - MediaPlayer1.SelectionStart
Label1.Caption = Format$(TimeSerial(0, 0, test), " h:mm:ss")

But it does not return milliseconds is there a way to return milliseconds smoothly.

Any thoughts?

ZeroEffect

Windows Media Player Play Problem
Hi,
I'm trying to use a wmp control to play a WAV file from a webserver (located on my LAN) but the wmp.controls.play isn't starting the audio.

My code already works for MP3 files from the same webserver, and it's only by accident I've discovered that it's not working with large WAV files.

What else I noticed is that if I put a break point on the wmp.controls.play statement, and then step to the next line, the wmp control does actually play the WAV.

I've tried putting a pause before the play, used a number of DoEvent statements, used the playerstatechange event to track the newstate variable, but it still won't work.

Any ideas on how to fix this?

Cheers,
Nap

Windows Media Player Looped Play
Hi,
In my application, I have a background audio track playing in the which I would like to loop once it gets to the end.
I have trapped the playstatechanged event and tested for MediaEnded (playstate = 8). However it's not looping back when I use the .previous and .play commands.

Here is my code:

Code:
If (NewState = 8) Then
wmcAudio(1).Controls.stop
wmcAudio(1).Controls.previous
wmcAudio(1).Controls.play
End If


I have tried putting delays and DoEvents inbetween each line but it still doesn't seem to loop for some reason.
However, if I put a breakpoint in the last line, and type the same commands into the "Immediate Window", the track starts up again.
So I'm wondering why it works when I manually do it, but not in code? Is it happening too fast in code?

Anyone have a solution for this?

Cheers,
Nap

Windows Media Player, Load + Play
Very simple,

I put the WMP control in my project and named it "MP"

1. how do I load a file and play it?

2. how can I load a file from an HTTP server and play it

thanks

- kurt

Play Asf File Using The Media Player Control??
Does anyone know the code for playing an .asf file using the windows media player control?

If not, does anyone know a control i could use to play an asf file?

Justin

Media Player Finished Video Play?
Is there some way to tell when Media Player has finsihed playing the current video? It most likely has something to do with 'state changes' but I'm not sure how to use it.

And just as a side thought is there some way to get rid of that logo that Media Player starts up with?

Can Windows Media Player Play From A Buffer
Hi ,

I need to create an application in vb where windows media player plays encrypted media files by decrypting them into a temporay file. The problem is that i cannot create the temporary file on some computers bcos(i do not have system privileges to write to the hard disk). Is there a way to create a buffer and make the media player read from the buffer and play it.
Looks like windows media player doesnt want to play anything other than from a file or URL.

Any ideas are greatly appreciated.

Thanks
Kp

Media Player (play When Command Button Is Clicked)
I am a little confused about the Media Player. I cannot get it to where it will play when a user clicks on a command button. I've tried (the name of the player being "wed"):
wed.open "C:My Documentswed.wav"
wed.command = "Play"

I used this b/c another thread said to do that, but an error message pops up in the code. What do I do?????????????

Cannot Get Windows Media-Player To Play An .mpeg File
Class project -- created a form with three tabs in it (selected "SSTab" control from the toolbox) ---> each tab is supposed to have something multimedia in it ... I'm working on one of them ... (still need two more ideas)

[COLOR=orange-red]My inquiry for help is this:[/color]

I have the WINDOWS MEDIA PLAYER in one tab (not ACTIVE MOVIE) and want to play one '.mpeg' file ...

[COLOR=orange-red]I have the following code:[/color]

Private Sub MediaPlayer1_DVDNotify(ByVal EventCode As Long, ByVal EventParam1 As Long, ByVal EventParam2 As Long)
MediaPlayer1.FileName = "C:Program FilesMicrosoft Visual StudioProject10 - Tabsaliensong.mpeg"
MediaPlayer1.Play
End Sub

[COLOR=orange-red]Results are:[/color]

I run the program, no errors occur, I click on the tab for the WINDOWS MEDIA-PLAYER, it displays correctly, I then place the cursor over the controls, they are not clickable but all the "ToolTipText" properties display for each one ... but I cannot play the '.mpeg' file.


I know I do not have the best grasp on this ... What am I missing? Code in the media player routine or other code elsewhere? Is there a property or two that I need to adjust?

Any guidance or suggestions appreciated.
Thank you,
~ Juanita

Can Media Player Control Play Live Radio
HI,

My question is that can media player control supplied with visual basic play live radio or not.

If yes, then how . Should i suppply a streaming radio url and from where to get this streaming radio url.

I have searched for these streaming radio urls but coudlnt find any.

If there is any other control which can do this then please tell me about that.

Urgent help required.

thanks

How To Use Windows Media Player (OCX) The Best Way To Play Midi Files?
Can anyone help me with getting sound out of VB 5 control creator edition?

i mean sound by any sound file
thanks

Stop Media Player & Switch To WebBrowser
I have a program which I want to open with an avi video. I want to be able to stop the media player at any time by clicking on Command button 7 or Command button 4 (each will open a separate web page).
Problem right now is when the program runs, when I click on the Command buttons the media player continues to play and I can't view the webbrowser. I know this is a simple question, but you guys are my tutors!


Also, any suggestions you have for making this better I'd appreciate.



Sub List()
Private Sub Form_Load()
MediaPlayer1.FileName = "http://mywebsite.edu/aearly/movies/mpa1.avi"
End Sub

Private Sub Command7_Click()
Call WebBrowser1.Navigate("http://www.nku.edu/~mpa/")
End Sub

Private Sub Command4_Click()
Call WebBrowser1.Navigate("http://www.nku.edu/~gradprog/graduate_application.pdf")
End Sub

Private Sub Command2_Click()
MediaPlayer1.FileName = "http://mywebsite.edu/aearly/movies/mpa1.avi"
End Sub

How To Reverse Play Back Using Windows Media Player Component.
Dear All,

Can any body help me or have any idea, how to Reverse Playback of video
files like .mpeg,.mpv,.dat using Windows Media Player Component. Or any
other better approach or any 3rd party control(s).

Actually, I am making an application to play the above mentioned video files
in the reverse order.

Please help me, this is very urgent.

Thanx in advance.

Bansi

Windows Media Player Control.. Random Play Of Playlist Files?
Much as I doubt it, I'm wondering if anyone here has experience with the WMP control using playlists. (I'm using .ASX playlists, if it makes a difference.)

I have the program playing great, everything is wonderful... all I need now is random play. You can set the random/shuffle in the .ASX header, but the MP control ignores it.

Is there a way to randomize things up a bit without actually making your own custom playlist system? I rather like using the ASX files, but if given no choice I suppose I'll have to write my own little method.

Thanks.

Can’t Play Wav File With Windows Media Player After Creating It With MciSendString
I am recording *.wav files with microphone using mciSendString.
I am using the following configuration strings
  i = mciSendString("open new type waveaudio alias capture", 0&, 0, 0)
  i = mciSendString("set capture bitspersample 16", 0&, 0, 0)
  i = mciSendString("set capture samplespersec 44100", 0&, 0, 0)
  i = mciSendString("set capture channels 2", 0&, 0, 0)
  i = mciSendString("set capture alignment 4", 0&, 0, 0) '
  i = mciSendString("Set capture bytespersec 44100", 0&, 0, 0)

I tried setting this last paramter to 176400, but it won’t take anything above 44100.

When I try playing these file(s) with Windows Media Player, I get a "Class not registered" error. However, if I right-click on it, select "Properties" and click on the "Preview" tab, I can play the file back without any problems using the "Preview’s" PLAY button.

Any help would be greatly appreciated.

Sincerely,
Paul D. Goldstein

Play All Type Of Movie In Same Window Using Window Media Player Property
Sir
i am using for play all type of movie file for that i m using Window Media Player property in VB when open first file its ok, and when open next movie file current media player window is closed, and open new media player windows .

I want sir how media player open all movie file in same media player window. i allwayes open movie in fullScreen size and how play all movie continue . i get and stored all movie file names in array like Dim fnam(20)


using code is :---

MP.AutoStart= True
MP.Displaysize=mpFullScreen
MP.filename="fullpath of file"

Thanx sir

Time Length Of Media Files In Windows Media Player
Isn't there a fast easy way to get the time length of a file that has been set as the windows media player.filename?

It seems like there should be but I can't find it.

Anybody else?

Wengang

Windows Media Player (new) Vs Media Player (old)
hi,

I have some questions on these 2 contols in VB.

Both controls used to play a video file in VB project.

1. Display Mode

As information, Media Player has a property named "DisplayMode".

It can be set to either mpTime or mpFrames.

Once I set to "mpFrames", I can get the total frame number of the particular video file with "Mediaplayer1.Duration" command.

But for the Windows Media Player, no "DisplayMode" property. I can't get the total frame number.

*Remark: Media Player can't support WMV format file.

2. Current Position

For Media Player, once the DisplayMode property is set to mpFrames, the CurrentPosition value refer to the frame number.

Since there is no DisplayMode property for Windows Media Player, the CurrentPosition value is refer to the second value of the video file.

Is there any way to set Windows Media Player "CurrentPosition" property refer to the frame number?


Thanks in advance

Windows Media Player (new) Vs Media Player (old)
hi,

I have some questions on these 2 contols in VB.

Both controls used to play a video file in VB project.

1. Display Mode

As information, Media Player has a property named "DisplayMode".

It can be set to either mpTime or mpFrames.

Once I set to "mpFrames", I can get the total frame number of the particular video file with "Mediaplayer1.Duration" command.

But for the Windows Media Player, no "DisplayMode" property. I can't get the total frame number.

*Remark: Media Player can't support WMV format file.

2. Current Position

For Media Player, once the DisplayMode property is set to mpFrames, the CurrentPosition value refer to the frame number.

Since there is no DisplayMode property for Windows Media Player, the CurrentPosition value is refer to the second value of the video file.

Is there any way to set Windows Media Player "CurrentPosition" property refer to the frame number?


Thanks in advance

Windows Media Player (new) Vs Media Player (old)
hi,

I have some questions on these 2 contols in VB.

Both controls used to play a video file in VB project.

1. Display Mode

As information, Media Player has a property named "DisplayMode".

It can be set to either mpTime or mpFrames.

Once I set to "mpFrames", I can get the total frame number of the particular video file with "Mediaplayer1.Duration" command.

But for the Windows Media Player, no "DisplayMode" property. I can't get the total frame number.

*Remark: Media Player can't support WMV format file.

2. Current Position

For Media Player, once the DisplayMode property is set to mpFrames, the CurrentPosition value refer to the frame number.

Since there is no DisplayMode property for Windows Media Player, the CurrentPosition value is refer to the second value of the video file.

Is there any way to set Windows Media Player "CurrentPosition" property refer to the frame number?


Thanks in advance

Shockwave Flash Player On Media Player
How can I place a Shockwave Flash Player on a medaia Player in Transparent View. I try to place it sy making the 'Windowless' property of the Media player to false and 'Window mode' of Flash Player to 'Transparent'. But it makes the low video quality and both are not working smoothly. How can I solve this problem. I need it for my project 'Jukebox' for this academic year.

Senkey Play, Pause (VB 6.0)
Heey all,

On my keyboard i have some keys for music. Play, pause enz..
How can i send this keys with visual basic 6.0

Thanks in advance

MediaPlayer Play & Pause ??
I have to botton on the form, one is for Play and the other is for Pause... Clicking on Pause botton works fine if the MediaPlayer is playing....if it is not then it gives an error as the MediaPlayer is not playing andy media file....Is there away by which I can make the program knowing if the MediaPlayer is playing media file or not ???

Play Pause Problem
hey ya'll
i mde a button in my mp3 player ( mediaplayer based ) that plays a paused song but i cant play e new song with it can anybody give me a hand

Stop & Pause
what i am trying to do is make it so when u user clicks the "Start" button, it will do something, but then there will also be "Stop" and "Pause" buttons. how can i make it so when the user clicks the "Stop" button, it will stop doing the command the "Start" button gave, and same thing with pressing pause only i can pause it, and then be able to resume it. i hope this isn't too confusing, and makes sense.

-ThX

STOP Or PAUSE The SUB Or FUNCTION.
Is there any possible to STOP or PAUSE the SUB when it is running.

Trying To Stop My Program (Pause)
I've written a program and I would like the ability to stop everything the program is doing and wait until a start button is clicked.

Can anyone help me on this???

How To Stop The Process Copy, Pause And Resume?
I have success make a copy file from drive to drive, but how to do when the copy file is in progress and i want to terminate it.?

here is my some coding:

start copy:
Private Sub CmdCopy_Click()

Dim i
Dim r
Dim lngHandle As Long, SHDirOp As SHFILEOPSTRUCT, lngLong As Long
Dim Ft1 As FILETIME, Ft2 As FILETIME, SysTime As SYSTEMTIME
Dim dValue

On Error GoTo Handler

r = Right(Dir1.Path, 1)
If r <> "" Then
CopyFile CDBox.FileName, Dir1.Path & "" + CDBox.FileTitle, 0
Else
CopyFile CDBox.FileName, Dir1.Path + CDBox.FileTitle, 0
End If

'Reset progressbar value to zero
ProgressBar1.Value = 0

'set progressbar max value to the value in the text box
'ProgressBar1.Max = Text1.Text

'Duh!
Timer1.Enabled = True

'assign variable the current percentage value for the progressbar
Percentage = getPercentage(ProgressBar1.Value, ProgressBar1.Max)

'call the BeginProgress to set the start time for the progressbar
BeginProgress

'Call the TimeRemaining function and display it in label1
Label1.Caption = "TimeLeft " & TimeRemaining(Percentage)

dValue = FileLen(CDBox.FileName)

For i = 1 To dValue
DoEvents
ProgressBar1.Value = i / dValue * ProgressBar1.Max
Next i

Exit Sub

Handler:
MsgBox "Error #" & Err.Number & vbCrLf & Err.Description, vbOKOnly, "Error"

End Sub


stop copy:
Private Sub CmdStop_Click()
'Halt Procedure
Timer1.Enabled = False
ProgressBar1.Value = 0
Label2.Caption = "Percentage 0%"
Label1.Caption = "TimeLeft 00:00:00"
Label4.Caption = "ProgressBar value: 0"

End Sub


module:
Dim sStart As String

Function BeginProgress()
'Call this when you begin th progressbar
sStart = Now
End Function

Function TimeRemaining(CurrentPercentage As String) As String

Dim maxTime As String
Dim sRemaining As String
Dim Mins As String

On Error GoTo Handler

'determine how much time(in seconds) has passed since the progress bar has started
maxTime = DateDiff("s", sStart, Now)

'make sure percentage is above 0%
If CurrentPercentage > 0 Then
'calculate how many seconds until progressbar is finished
sRemaining = Val(maxTime / CurrentPercentage) * Val(100 - CurrentPercentage)
'convert seconds into Minutes:Seconds format
Mins = Format(Fix(sRemaining / 60), "00")
'set return variable to have Minutes:Seconds left and also Hours
TimeRemaining = Format(Fix(Mins / 60), "00") & ":" & Format(Mins Mod 60, "00") & ":" & Format(sRemaining Mod 60, "00")
End If

Exit Function

Handler:
TimeRemaining = "Error"
MsgBox "Error #" & Err.Number & vbCrLf & Err.Description, vbOKOnly, "Error"

End Function

Function getPercentage(ProgressBarCurrentValue As String, ProgressBarMaxValue As String) As String
'calculate Percentage completed of progressbar
getPercentage = Format(Val(Val(ProgressBarCurrentValue / ProgressBarMaxValue) * 100), "0")
End Function

How To Stop Or Pause A Function And Restart It From The Point Where Stopped?
Is there a simple way in Visual BAsic to Stop a function and then again start from the point it was stopped?

Example

User presses Start->

Start_OnClick()

Function 1
Function 2
Function 3

User presses Next ->

and Function 4
Function 5

should be continued...??????

Insturction Pause , Delete , Stop In Visual Basic 6
Hi
    every body
    Please help me , i want create program Pause ,delete ,stop document for print all program in windows
    Please tell me

                                     Thank you advance...Goa99
  

Help!!!How Do You Play Media Such As Music?
Help. I need a code sample that uses the play command in vb. Can anyone help me? I know its play... but i dont know the exact code thanks.

How Do I Play A Media File...
I just got Visual Basic 5.0 for Christmas and am tring a few things. My Question is "How do I get a VB form to start the defalt MP3/wav player? or to play the sound files itself." an example would be great. thanks, Drew

Directx Engine Media Play
anyone ever make a media player using the directx engine? i am having trouble with full screen and how to make a full screen mode. also how can i set the video to play in an object such as a picture box instead of the Active Window?

hopefully someone has some experience with directx engine. any suggestions and help would be nice. thanks.

Directx Engine For Media Play
anyone ever make a media player using the directx engine? i am having trouble with full screen and how to make a full screen mode. also how can i set the video to play in an object such as a picture box instead of the Active Window?

hopefully someone has some experience with directx engine. any suggestions and help would be nice. thanks

Windows Media 9 Won't Play File..HELP!
Hi ,
I recently downloaded a video clip and then when I finally try open it I got this error message " The content you are trying to access requires an additional level of security , in order to play it you'll need to update your digital rights management installation"

Anyone ever got this kind of message? How do I solve it? Many thanks in advance

Copyright 2005-08 www.BigResource.com, All rights reserved