473,473 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Trouble with DirectX.AudioVideoPlayback.Audio

If I have an audio file playing using DirectX.AudioVideoPlayback.Audio and I
click the stop button, using the following code:

Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStop.Click
Try
Player.StopWhenReady()
Catch
End Try
End Sub

Private Sub PlayerStopped(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Player.Stopping
While Player.Stopped = False
'do nothing here. we're waiting for it to stop.
End While
Timer1.Stop()
Try
Player.Dispose()
Player = Nothing
Catch ex As Exception
End Try
trkPosition.Value = 0
lblPosition.Text = "0:00"
MsgBox("Made it thru this sub")
End Sub

I get the following exception:

System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."
Source="Microsoft.DirectX.AudioVideoPlayback"
StackTrace:
at AudioWndProc(HWND__* hWnd, UInt32 uMsg, UInt32 wParam, Int32
lParam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG&
msg)
at
System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationCo ntext context)
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[]
commandLine)
at eDeeJay.My.MyApplication.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Line 81 referred to in the StackTrace happens to be the "Handles
Player.Stopping" line.

I was using:

Try
Player.Dispose()
Player = Nothing
Catch ex As Exception
End Try

in the btnPlay_Click event to unload the player and reload and it worked
fine. But I need to unload the player when I click the Stop button. If I
move the Try block back up so it is in the Play button event code, it works
fine again. The MsgBox in the Player.Stopping event fires so I know it's
making it all the way through the code there. But as soon as I click the OK
button in the MsgBox, I get the error above. What gives?
Jan 15 '07 #1
0 2004

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kieran Benton | last post by:
Hi everyone, Sorry this is more than a little off topic but Im having a terrible time trying to get anyone at the managed directX groups to reply so I'm going to try with everyone here as they are...
2
by: Michael Mayer | last post by:
First of all, sorry for the cross-post. Seems like there should be a managed directx newsgroup. I'm trying to open the following sample application that comes with the DirectX SDK....
2
by: Ian | last post by:
Does anyone know of a way where you can bind one of the Audio objects from DirectX.AudioVidoPlayback to a DirectX.DirectSound object? I need to do this because I need to be able to play several video...
0
by: | last post by:
I created a little app to play videos in a panel and its eating memory. no matter what i do it takes more memory with each clip. i tried everything even closing the form everything is declared in,...
0
by: Jovo Mirkovic | last post by:
Hi, Any Windows action which minimizes all windows (win + D, ctrl + alt + del) is causing program error I have two forms: Form1 is shown on primary monitor on dual head graphics display
4
by: mariusz | last post by:
Hi All, I have a problem with component DirectX.AudioVideoPlayback.Video. Following part of code works good but I have one problem. The movie is allways on the top left corner of the display....
2
by: Z.K. | last post by:
I was wondering if someone could tell me why I get this message and how to prevent it. If I hit continue, it runs fine, but want to know what I am doing wrong so I won't get this error in the...
11
by: raylopez99 | last post by:
I just downloaded the apparently free SDK for DirectX 9, all 200+ MB of it, but as I read about WPF I wonder: is DirectX obsolete? Should I even bother learning how to use it? After all, the end...
1
by: not_a_commie | last post by:
The DirectX installer won't install the managed DLLs unless the .NET runtime is installed first.
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.