Playing Video Using DirectX ?

Sep 18, 2009

I have scoured just about every code sample on the web, and am still having trouble. Basically my code follows the following structure:

I installed the DirectX SDK, and imported AudioVideoPlayback Imports Microsoft.Directx.AudioVideoPlayback '''

Then I create my VideoPlayer Public WithEvents VideoPlayer as Video So far so good, I have event handlers and a video object

Then:

[CODE]...........

I execute the above subroutine and the video plays flawlessly

[CODE]............

The above code works perfectly as well

Then I try to execute the PlayVideo sub to play another file and I get a generic "Object reference not set to an instance of an object" error, that does not point to any particular line of code. It took me forever to find out exactly what line of code was causing this. So I came up with a workaround:

In the PlayVideo sub I changed the code to this

[CODE]..............

And there it is, the second video played without error. but then I noticed something, after the second video ended the .Ending event handler did not fire, actually all the event handlers basically died. So someone told me to use a timer to monitor when the video ends, and I basically laughed it off since we know that's an amateur move. After being frustrated for a while, I caved in and used the timer to do my dirty work, which I really don't like.

Now there's another problem, after I play a video in my project, DirectX is not screwed up for other programs until I restart my computer. Particularly I have a visualization plugin for Windows Media Player called Gforce. After I play a video, Gforce will not work, it gives me an "Error=18" which means that my computer does not have sufficient hardware to use it. The only way to be able to clear it up is to restart my computer.

Here are my specs:
Intel 3.0ghz Dual Core processor
Nvidia Geforce 9800GT with 1GB ram
4 GM Ram
Windows 7 64-bit version (build 7100)
Programming in Visual Studio 2008 Professional (using Visual Basic code)

I originally attempted to use the AxWindowsMediaPlayer control, but I am unable to. According to Microsoft there is a bug that prevents me from using it. When I pull up the choose items dialog box it does not show up, if I browse to wmp.dll to manually add it, I get an error ("self-registration for c:windowssystem32wmp.dll failed"). I also read that you should try to add the wmp.ocx instead of wmp.dll, but I am at a loss on this since I am pretty sure that file does not exist. I am trying to put together a new media player program for my theater pc and this video thing is putting me to a standstill. I am a highly experienced vb programmer (over 20 years), but I am not very experienced in DirectX. I have read a lot of code samples on video playback but they all give me tons of problems, so I hate to say it but i think that most of these samples were written by people who don't know what they are doing.

View 2 Replies


ADVERTISEMENT

Playing Multiple Sounds Without Using DirectX

Feb 1, 2010

Is it possible to stream more than two sounds simultaneously in .NET without using DirectX?

To obtain foreground and background effects I currently use the following:

' Background music
Private bkMusic As New SoundPlayer(My.Resources.bkm)


[CODE]..................

SoundPlayer is a wrap around to the win32 API:

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

While for actual in game sound effects I am using a class that implements:

Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpszCommand As String, ByVal lpszReturnString As String, ByVal cchReturnLength As Long, ByVal hwndCallback As Long) As Long

It works. 1 snd effect at a time overlapping / mixing with the background music. But I am on the hunt for a better method which allows me to stream multiple snd effects simultaneously. DirectX is not an option, because most people (my audience) don't have the SDK (software development kit)

View 4 Replies

Directx Audio Stops Playing When Change Window?

Sep 15, 2009

So I have a wav playing using DirectX in VB6. If i switch to another window, it stops playing. If I click back on the VB6 window it resumes play. How do I make it continue playing when I change windows? Another problem I cannot load wav files larger than 50 megabyte. It says Out Of Memory. How can I increase that?

View 1 Replies

VS 2010 Cannot Dispose DirectX Audio Object After Playing?

Nov 14, 2011

I'm playing an audio file like so:

VB.NET Dim audio As New Audio(Application.StartupPath & "est.wav", True) audio.Balance = 10000 audio.Play()

Which works great. But if I need to change that file, I get an UnauthorizedException because the I haven't disposed of it. But, if I add a dispose after .Play, it won't play.

View 2 Replies

Play Video In DirectX (WPF)?

Apr 9, 2011

I have a WPF 4/VB.net project, and I'm trying to play video in it. I've been using a mediaelement, much to the chagrin of the program's overall performance. Thus, I'm looking into the only other viable alternative that I can find for my project...directx.

Which brings me to my question. Is it possible to play video (either Theora [.ogv] or Flash Video [.flv]) in DirectX?

View 1 Replies

Make Audio / Video Player Using DirectX

Sep 16, 2009

i need Help to make Audio or Video Player With Using DirectX. how many Different b/w DirectX and Windows Media Player???

View 8 Replies

Using The DirectX 11 SDK, Load A Video (with Sound) And Play It?

Nov 2, 2010

I am having problems locating any documentation or examples for rendering video on a form using DirectX. I need to use DirectX because I will be putting overlay's on the video loaded dynamically. I will also want to perform transitions between 2 video instances.

I can not find any documentation on Google or Microsoft's site, Such as render the video on a 3d object as a texture, maybe... IDK?

This is for Visual Studio 2010, .net framework 4.0, using vb.net.

View 1 Replies

Playing Video Files (And Not Using WMP!)

Oct 3, 2010

This is tied in with the other discussion that I started last week about playing audio files using the DirectX classes. If you haven't yet had a look at that other thread,Using the same reference as in the audio application, let's set up a form for video this time. I started with a form that I then placed a split container on and in the lower panel of the split contatiner, I placed the buttons and other controls. Following is how I have mine set up:

Reread the thread on the audio player because the methods are very similar - in fact some are identical! However, this is video and it got a bit more involved as you might expect.The full code is here and I hope you'll find it useful to you. Following is a screenshot of the end result.

View 2 Replies

Playing Video From Buffer?

Apr 29, 2012

Im trying to do a video player but i have to play this video from the buffer, is this possible.. Let me explain you much more complicated,a got a CryptoStream and im decryting the video

While lngBytesProcessed < lngFileLength
'Read file with the input filestream.
intBytesInCurrentBlock = fsInput.Read(bytBuffer, 0, 4096)
'Write output file with the cryptostream.

[code]....

This code writes my decryted or crypted video to a new file. However, i need to play the video file from the buffer(without copying to a new file), in other way it would be meaningless if i create a decryted file. in other words it would unsecure for me cuz if anyone can locate my temp directorey they can copy my decrypted video files.

View 5 Replies

Find Out If A Video Is Finished Playing?

May 21, 2010

How do I tell if a Video is finished playing?

View 3 Replies

Get The Size Of A Video Befor Playing

Dec 1, 2010

My program lists all my home movies filmed with various video cameras.When I select the video from the listbox, Windows media player plays the video.However, I would like to know the dimentions of the video before it is loaded.I could,therfore, tell which camera was used to film it.Some video is 1920 by 1088 frame width/height Some is 1280 by 720 and some various other sizes Is it possible for VB 2010 to give me the dimentions ??

View 2 Replies

Get The Video To Finish Playing In AxWindowsMediaPlayer?

Mar 11, 2011

How do I get the video to finish playing in AxWindowsMediaPlayer before it loads another form? It keeps showing the next form briefly before the video starts.

View 2 Replies

Pause While One Video Is Playing, And Later Play A Second One?

Mar 18, 2011

I'm playing videos in a form with an embedded media player, I want to play one, and later another one, how I can programm a pause for the first video to play, and later to play a second one. system.thread seems is not the solution for me.

View 4 Replies

VS 2008 Playing Video Files?

Sep 10, 2009

im new to VB and i would like to ask some questions;Im developing a Media Study Room program and i have this little problem, My problem is that, how can i designate the video in the list box, that when i click variable on the list, it will automatically play the video i designated to a number and its description in the bottom will appear.

View 18 Replies

Interface And Graphics :: Playing A Video On The Form?

Mar 4, 2009

Ok, i know the simple media controls to play a video file on the control screen, but is there a way to play the video on the form background?

View 2 Replies

Playing Single Video In Multiple Forms?

Mar 3, 2010

if i have mediaplayer1 in Form1 and mediaplayer2 in Form2 than how can i play and control a single video file in both mediaplayer1 and mediaplayer2 in vb.net

View 1 Replies

Playing Video - Auto Seeking In MediaPlayer

Mar 4, 2010

If I have a video of 70 Seconds and I want to play it directly from 31 seconds to onwards how can I do that in vb.net.

View 1 Replies

VS 2008 Playing Camtasia Video In Web Browser Control

Dec 24, 2009

I have tried to play a Camtasia video inside a web browser control but it comes up with javascript needs to be enabled error on page. How can I work it or find a work around that? I'd like to have a listbox that contains the movies and they would play in the browser. I have a membership site that I'd like to have a player that authenticates the user before playing them but first things first, what is the best way to accomplish playing Camtasia videos inside a form?

View 25 Replies

IDE :: Change The Size Of Video Playing In Window Media Player

Jul 13, 2009

I am developing an window application in which I have to change the size of video playing inside media player. i don't want to change the size of media player.

View 3 Replies

Video Playing Code In Button Click Must Stop For 5 Seconds?

Mar 15, 2012

i am doing an gaming project in vb.net 2008..my problem is i wrote code to play the video in button click,,so codes after the video playing code in button click must stop for 5 seconds how to do it?i cant use threading.thread.sleep(5000)if i use that then entire program execution will stop for 5 seconds if i use that then video will also stop playing.........

[code]...

View 8 Replies

VS 2008 Check That Wmp Video Has Started Playing Before Can Press The Full Screen Button?

Mar 24, 2010

I have a full screen button, so that when it is clicked the windows media player control will go to full screen. This works fine, however I need a way to check that the video has started to play before the button can be pressed to make it full screen.

View 2 Replies

Get Media Playing Now Playing Using Sendmessege / Wmp.dll?

Jan 22, 2010

How I can get the Media playing now playing using Sendmessege or wmp.dll?

View 5 Replies

Inserte Pictures And Video - Can't Move The Program To Another Computer Because The Pathname For The Video Will Be Wrong

Jun 22, 2010

I have a vb.net project which i have inserted pictures and video. I inserted a video clip using the Windows Media Player control and it does work. The issue i have is that i can't move the program to another computer because the pathname for the video will be wrong. I know i could change the pathname when i move it but this is not practical because i need to present this program. Does anybody know how to make the video accessible no matter what location the program is at?

View 6 Replies

Monitoring 12 Video Feeds From Video Cameras - NEXT Or FORWARD Button On My Monitor Form

Dec 24, 2009

I am monitoring 12 video feeds from video cameras. Now I have more than 12 cameras, I have 134. But I will only monitor 12 cameras at a time. By Monitoring I mean, I have 12 small video screens on the form that I can see the video. The way I know which cameras are active, so I can monitor them is by a boolean value in a sql database. I run a Store Procedure in my program, and spit out the results in a XML file. I then read the XML file in a loop. This XML file will have a list of the camera names I need to monitor.

So that is for 12 video feeds. Now, I want to have a NEXT or FORWARD button on my monitor form. So when I click this it will give me the next group of cameras, 13 to 24. Now if I only have15 cameras that are active, that means the first group is 1 to 12, then the second group is 13 to 15 cameras. So I will only have 3 to monitor on the second grouping. One thought I had was to have another field in my table to mark as already as an active monitor, so when I run the SP, i will not select that row. But I need to select 12 at a time. Or I can make a number of xml files, one xml file for each grouping of 12, but I need to figure out how I can select the next group without re-selecting the first group. I have no code at the moment, I'm on my non-programming computer.

View 4 Replies

Create Audio Video Chat - Client Move His Or Her Webcam Video Where Want?

Oct 17, 2011

I creat audio video chat and when calling receivng video and client video is together...I want that client move his or her webcam video where want...as I know it name DROP&DRAP but I`m not know how to do it...

View 5 Replies

It Open A Bunch Of Tabs That All Go To A Link With A Video, And Then Have It Automatically Play That Video?

Jul 7, 2009

I was wondering if it was possible to have a program open Firefox, and have it open a bunch of tabs that all go to a link with a video, and then have it automatically play that video?

View 4 Replies

Get Video Thumbnail From A Video File (from A Directory In Hard Drive)?

Jul 21, 2011

I would like to create thumbnails into a VB (2005 or 2010) form from video files.

I have a directory (in my hard drive) with video files (.mpg).

How to show video thumbnails for each video file?

My VB code (for images) is attached below and I want to convert it in order to manage video files.

Private Sub ThumbButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles ThumbButton.Click
Dim imagepath As String

[Code].....

View 2 Replies

Make A Video Streaming Server Or A Video Lan Chat Programme?

Jun 22, 2010

i want to make a video streaming server or a Video Lan chat programe in VB.net

View 1 Replies

Recording Video Via Video Webcam Within Visual Basic Application

Dec 5, 2009

How can i record a video via webcam in visual basic application and then display the video on user's request either live or recorded video.

how to develop video webcam recording application.

View 4 Replies

What Syntax Use To Buffer Video The Video In Client's Media Player

Jul 12, 2010

i want to buffer a video file on client side when it request.. what syantax i use to buffer the video the video in client's media player

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved