Thanks to the ADAM provider model, writing custom media engines to process media actions has always been a walk in the parc.
Simply let your custom media engine inherit from MediaEngine, implement the Run method and register and activate it in ADAM.
However, there always have been a few limitations. Certain scenarios were not supported. For instance, since ADAM is currently
build on .NET 3.5, you were unable to implement media engines depending on .NET 4.0. Furthermore, it was also impossible to
run a 32-bit media engine on a 64-bit machine with a 64-bit ADAM installation.
Enter ADAM 4.6, with its brand new Proxy Media Engine type and Media Engine Host Service!
How does it work?
The Media Engine Host Service is a windows service written on the .NET 4.0 framework. It is able to create and run any type of
media engine, independent of which version of .NET it is using. Furthermore, when you have installed ADAM 4.6 on a 64-bit machine,
you will have a 32-bit and a 64-bit version of this service. This allows you to even run a 32-bit only media engine on a 64-bit
machine. Yes sir, you just gained an extra platform!
"So how can I enable this cool feature?" I hear you think. Just follow these simple steps:
Install Media Engine Host service
First thing you need to do is install the bits. When you run the ADAM 4.6 setup, you'll notice that there is now an additional
feature that can be installed, i.e. ".NET Framework 4.0 Media Engine Support".
Note: this feature will only be available when the .NET Framework 4.0 has been installed on the machine.
After the installation has completed, you will see one or two additional windows services have been installed, depending on
whether you have a 32-bit or 64-bit operating system.
Write your custom Media Engine
Nothing has changed here. Simply write your custom media engine by inheriting from Adam.Core.MediaEngine. However, now you can target
the .NET Framework 4.0, either on x86 or x64 platform, if your media engine requires this.
More information on writing custom media engines can be found in the ADAM Developer Guide.
Register and activate your custom Media Engine
When you are finished coding you only need to register and activate your custom provider into ADAM.
As explained in the ADAM Developer Guide, this is a two-step process:
First you need to register your custom assembly. However, if your assembly is a .NET 4.0 assembly, you will not be able to register it
into the ADAM database via the ADAM Command Line Prompt, since the ADAM platform is not built upon the .NET 4.0 runtime.
This means you can only register your assembly by putting it into the GAC.
Secondly, you need to add your media engine to the list of registered media engines in the .registeredMediaEngines setting. It is here
that you need to tell ADAM to run the media engine on the Media Engine Host service. All you need to do to accomplish this is
wrapping your media engine with the Proxy Media Engine.
| XML |
1
2
3
4
|
<add name="MyCustomMediaEngine"
type="Adam.Core.MediaEngines.ProxyMediaEngine, Adam.Core"
proxyType="MyAssembly.MyCustomMediaEngine, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
proxyPlatform="x86" />
|
As you can see, the type attribute points to the Proxy Media Engine, indicating that your custom media engine will be hosted and run
on the Media Engine Host service. Also notice the proxyType and proxyPlatform attributes: the proxyType attribute holds the definition
of your custom media engine while the proxyPlatform indicates on which platform it should run, 32-bit or 64-bit.
Well, that's it really, you're done. Your media engine will now be hosted and run on the Media Engine Host Service.
Monitoring the Media Engine Host Service
When you're running your custom media engine using the Media Engine Host Service, you might want to monitor the status of your engine
on the host. There are a couple of ways to do that.
Event Viewer
The Media Engine Host Service logs all its activity to the Event Viewer. Each log entry contains detailed information, such as the
(proxy)Type of the media engine in question, the proxy instance id (i.e. the id of the Proxy Media Engine wrapping your custom media engine),
the registration name, the Application's session id, ...
ADAM Command Line Prompt
Another way to get some status information of the Media Engine Host is through the ADAM Command Line Prompt, using the MediaEngineHost
switch. If you do not provide a specific engine id, you will get a list of all currently active media engines on the host.
Using the platform option, you can indicate which host you want to query for information, the 32-bit or 64-bit version.
If you want more detailed information on one particular instance, you can pass that with the engine option.
That's a wrap! I hope this post has given you a clear insight on the new Media Engine Host feature and how you can benefit from it!