I found that your handler
videoSourcePlayer_NewFrame
is never called. In turn, this is because
Initializevideo
is never called. I simply called
Initializevideo
from the form's constructor (is it appropriate to call it just once, or you need to call it on every stream again and again? (I don't think so)), and now the
NewFrame
event is fired and your handler is called. I don't see any visual effects, but now this is your problem. The bug is found.
That was easy to find, but the code is hard to read. This is the only reason for the bug -- you have compromised control and vision just because of some (minor) mess. You need to do some steps:
1. Stop doing Microsoft suggested all-design-time way -- it's just for cool demos and lamers. I mean, simply remove all auto-generated codes setting events. Do it in manual code in one place (see some suggestion below). Use clear lambda syntax:
MyComponent.MyEvent += (sender, eventArgs) => {
}
2. Please create another source file for the form (the class is
partial
, so you can have as many as you want).
3. Please separate your own code from auto-generated, moreover, UI from logics (maybe create another source file for the form: you will have 3 files: 1) your own UI aspects, 2) your own video aspects, 3) Microsoft auto-generated stuff (which is already there)
4. From Properties node, remove everything except
AssemblyInfo.cs
until you actually use this crap (good chances are -- you will never use them; resources are better in separate Resources directory; you will create them at any moment).
5. Create one single method to setup all events in one place (maybe, two:
SetupUiEvents
and
SetupVideoEvents
in syntax shown in (1)). Call both methods from the form constructors, better at the very end.
6. You should never submit
.\bin
.\obj
*.suo
, (also
*.user
, etc.). You need to know exactly what files belong to the source.
That's it. This layout maybe 1) not perfect, 2) too much of my own style; no matter, still better then yours; with time, you'll improve it closer to your taste. I mean, you may choose not to do put things in order in this way, but consider this: I spent only few seconds to discover the bug, but... how long? well, wasted too much time to review where is what. Next time it may bother me too much to take care.
As I answered your question precisely, I think you should accept this answer. A good vote will not hurt either.