MIP SDK 2018, Missing File for LiveViewer

Background:

My company provides an application written in C++ v140 x86 that allows us to connect to a large number of video integrators. The video integrators are commonly written in C#, and are consumed by the Video Player. We can support concurrent connections to several different video integrators at the same time. And can support concurrent views of different cameras from different servers and different video integrators all at the same time streaming live.

Issue:

I can live-stream video with the MediaLiveViewer sample project without issue. I even have my MediaLiveViewer building to the same location as my video integrator. But when I attempt to stream live video in my video integrator dll, I receive the error message “Missing library: VideoOS.Platform.SDK.Media.dll”. This dll certainly is not missing, as it is referenced in code and exists in the build folder. I can connect to the server fine, get all the cameras and camera details. The LiveSourceContent is always null though, when running the code against my video viewing project.

I also have loaded all the additional dlls that are copied into the build folder, post-build from the CopyMedia.bat, as the MediaLiveViewer does.

If anybody has an explanation or a direction I should take to get the Live Video to start streaming, that would be MUCH appreciated.

I am developing my component dll in C# 4.5.2.

NOTE: I just changed the MediaLiveViewer to be a DLL instead of an EXE, then called it from a very simple exe that only runs:

Application.Run(new MediaLiveViewer.SimpleForm());

The result is the same as I get above in my Video Integrator. (same missing library) WHY can’t LiveView work inside of a DLL? There must be a solution to this.

I guess the exe is also the same .Net version.

My best guess is that when the Media dll uses its dependencies the current directory might be changed and the dependent dlls are not found.

Perhaps you can try to put out the current directory information when you call the Application.Run(new MediaLiveViewer.SimpleForm());

I think I understand what you are saying, but for my application, all programs run out of the same bin folder (because many of our applications share dependencies). So in my case, my main EXE that calls my DLL, are both located in the same bin folder… along with all of the dependencies, including the Milestone dlls.

I please invite you to change the MedialLiveViewer to be a DLL, then call it from an exe.

There must be a solution this issue.

The exe is 4.5.2.?

If you explore the VideoOS.Platform.SDK.Media.dll using the mdepends tool does it say something is missing?

http://download.milestonesys.com/mipsdk/mdepends.zip

Can you share your modified MedaiLiveViewer project?

I’m not sure how I would share the project. Just change the Output Type in the Application Properties to “Class library”, in the MediaLiveViewer project. Then create a new desktop application that calls the class library in the program.cs file. (also make sure your dlls all land in the same build folder)

Using your tool, if I explore my Milestone_Mip.dll, it makes no mention of VideoOS.Platform.SDK.Medial.dll.

If I explore VideoOS.Platform.SDK.dll, it makes no mention of the Media.dll. In fact, no matter which dll I select that is referenced by my project, it never mentions the Media.dll

The MediaLiveViewer sample has a reference to VideoOS.Platform.SDK.Media.dll and has a VideoOS.Platform.SDK.Media.Environment.Initialize();

Maybe this is what you miss when you transform the sample.

This line of code: VideoOS.Platform.SDK.Media.Environment.Initialize(); immediately throws an exception when running under a DLL… which is the basis of this thread.

But I think you miss what I’m saying. If I leave the MediaLiveViewer as an exe, it runs correctly. If I change it to be a DLL, it no longer runs. I have tested this with other examples as well.

Thus far, the Milestone SDK does not support running out of a DLL, which should be seen as a MAJOR BUG.

We just tried doing as you suggested:

  • We changed MediaLiveViewer to be a class library,
  • Renamed the form to SimpleForm,
  • Added VideoOS.Platform.SDK.Media.Environment.Initialize(); to beginning of SimpleForm() constructor
  • Called Application.Run(new MediaLiveViewer.SimpleForm());

And it works fine. No exception and video is showing.

This is the reason why we asked you to upload the exact solution you had made, so that we can easier investigate exactly what is the difference.

Just to make sure I’m not crazy, I started over. I added the project MediaLiveViewer_Login, to take care of authentication, then call the MediaLiveViewer as a dll after authentication. Both are building to the same folder. I still receive the “Could not load file or assembly 'VideoOS.Platform.SDK.Media”.

Would you be able to provide me a link to your demo code that works? (or zip it and email it to me)

Give me your email address, and I’ll email you my solution if you’d like

Please find my solution attached - should be able to build out of the box if you have the SDK installed at standard location.

Your demo does indeed play video. Which led me back to the demo code I was updating… which still didn’t work.

I made some changes, such as:

Changed to .NET 4.5.2

Changed to “Any CPU”

auto-login without the UI

auto-play camera 4 (my camera 4 has motion)

After all this, I still don’t see why my original demo app didn’t work. I moved it out of the Components solution, and into its own solution… then dropped the MedialLiveViewer reference from the calling application, and added it back. That for whatever reason seemed to make a difference, and now it plays.

But after all this, I still am not closer to getting my Video Integrator working. There was essentially nothing in your demo that was blatantly different, that would cause the Medial.SDK.dll exception, other than you calling “VideoOS.Platform.SDK.Media.Environment.Initialize();” fairly often.

I’ll upload my Video Integrator code for you to see. You will not be able to run it out of the box, but maybe you can see some reason it would be throwing the Missing Library exception.

Here is my Video Integrator code. If something is glaring at you, please let me know. I included a dependent DLL in the zip folder, if you want to build it.

The line: VideoOS.Platform.SDK.Media.Environment.Initialize(); throws an immediate fatal exception in the program. No matter where I put it, the exception is immediately encountered. If I remove it, the code runs without exceptions, but doesn’t stream video.

I made a very small sample application (attached) just calling your DvrConnect.Connect method (which is the one calling Media.Environment.Initialize()) and got the exception you describe.

I then observed that you had the following in your post-build event:

cd “[C:\Program](file:C:/Program) Files\Milestone\MIPSDK\Bin”

call CopyMedia.bat “[C:\Program](file:C:/Program) Files (x86)\Maxxess\Axxess Workstation\bin\”

And at least on my machine that did obviously not correspond to my project folder.

For ease I just added my own CopyMedia call to the application project (could just as well have modified the one in your dll project, but this was easier) and ran again. Now connect works fine with no exception in the Initialize call.

So either the location you run your application from (I cannot see that since you did not include it) is not what you expect it to.

Or something else I came to think of triggered by the above copy statement: Your application is 32-bit? If your application is 32 bit you need to compile in that version and - very importantly - download the 32-bit redistributable from our web-site (same location as you downloaded the SDK from) and use the SDK binaries from that instead. Some of our implementations are done in unmanaged C++ and it is extremely important that the bitness of those dlls matches the running application.

We had downloaded MIPSDK_Installer_2018R1.msi. There is no option for a 32 bit version. What redistributable are you referring to?

(Please provide a link)

You will find the redist download link right next to where you downloaded the main MIP SDK installer. If your MyMilestone account is associated with a Milestone Solution Partner you can find the link to the downloads section in the menu on the forum front page (https://www.milestonesys.com/my-milestone/msp/mip-sdk/).

Otherwise you can find it on the main Milestone site under Community->Developer Tools->SDK (https://www.milestonesys.com/community/developer-tools/sdk/download-sdk/). There you will have to provide your details to access the download.

I installed the x86 redistributable, and still have the runtime issue. The build has this warning, which at least makes me wonder if this is the issue:

1>[C:\Program](file:C:/Program) Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built “x86” and the processor architecture of the reference “VideoOS.Platform.SDK.Media”, “AMD64”. This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

1>[C:\Program](file:C:/Program) Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built “x86” and the processor architecture of the reference “VideoOS.Platform.SDK.UI”, “AMD64”. This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.