DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Sync DIAdem with external video || DIAdem and c#

Solved!
Go to solution

Hello,

I am a C# programmer and I'm having a difficulty which I can't find a solution to.

 

 My company built some kind of synced-multi-video-player.-- in other words, it can  play a number of videos in a window synchronously.

 

Question number 1 : Along with the videos there are data files, which are already in .tdms format. We need these files to play in DIAdem synchronously with our video player . How can I do that?

 

question number 2: Can I do that with C#??

 

Message 1 of 9
(7,415 Views)

Hey OmerK,

 

There are a few options here, but synchronizing DIAdem with an external program might be challenging. What method do you have of controlling the video player (i.e. does it support ActiveX or are you simply wanting to run the executable at a certain time)? I'll go ahead and present a few options:

 

1. Save a video of the data playback in DIAdem and load that video into your company's video player: You can use a program such as Camtasia Studio (http://www.techsmith.com/camtasia.html) to record the data playback in DIAdem, and then simply run this from your company's program with the other videos.

 

2. Export a single video from your company's program and load that into DIAdem: DIAdem has the ability to synchronize a video with data playback, as seen in this help file: http://zone.ni.com/reference/en-XX/help/370858K-01/procview/procview/procview_video_synchronize/   This would allow you to use DIAdem's synchronization settings to line up the video and data playback, but would only be possible if you have the ability to export a single video from your company's player.

 

3. Run the video player from a DIAdem script with ExtProgram: There is a function in DIAdem called ExtProgram, here's a help file on it: http://zone.ni.com/reference/en-XX/help/370858K-01/comoff/extprogram/   You can use this program to call an external program such as your company's video player. The downside to this solution is that it's rather indeterminate as far as how long it will take from calling this command to the videos actually playing (due to Windows taking a non-uniform amount of time to load programs) so it will be very difficult to synchronize unless you can use ActiveX or something similar to trigger playback of the video.

 

I hope one of these solutions works for you--if you have any further questions, please let us know!

0 Kudos
Message 2 of 9
(7,384 Views)

Hey Daniel, thanks for the fast reply.

 

We control our video player via time. All the videos are synced and have a single reference time.

If an option of sending timestamp to or receiving timestamp from Diadem it would be the perfect solution.

 

As for your suggestions --

 

1. We can't record a playback because our program should receive data files from a source and play them with the video automatically

 

2. All the videos must be played at the same time.

 

3. It could be a solution, but will running the video player from DIAdem actually sync them together?

 

Thank you!

0 Kudos
Message 3 of 9
(7,367 Views)

OmerK,

 

How would you like to get the timestamp from DIAdem to your application? I believe I'm missing a piece of the puzzle here; I just need to understand how you're wanting to communicate between DIAdem and your company's media player. Are you going to be making ActiveX calls or DLL calls to send the media player a timestamp?

 

There might be a way to export the timestamp from DIAdem, I just need to understand the big picture a little better, as far as how these programs communicate and what the workflow looks like. I look forward to hearing from you!

Message 4 of 9
(7,355 Views)

Sorry Daniel for forgetting.

No,no ActiveX. Just a regular desktop application.. Therefore dll is the answer to your question.

 

If I could export the timestamp from DIAdem to my app it would be great, if I could do the opposite it would be even better!

What kind of dll do I need? And how can I play the graph by the imported timestamp, in case of importing to DIAdem?

 

Thank you!

0 Kudos
Message 5 of 9
(7,350 Views)

Hey Omer,

 

I talked to a few colleagues, and our consensus is that the best way to solve this problem is to use DIAdem to play all of the videos and synchronize them with the data files. So in DIAdem VIEW, you can create a new view and select the number of display areas with the buttons on the left--I chose 4 areas, arranged in a square. You can right-click on each one and choose Display Type to set what kind of data is displayed there. If you choose Video, you will be prompted for a video path. So you can configure these display areas to show videos or the data files, as needed. This is by far the best way to synchronize the display in the manner you're seeking.

 

For an example of this, in DIAdem you can go to Help > Examples, and in the Example Finder go to Examples > Viewing and Editing Data, and choose the "Synchronizing Maps, Videos and Measurement Data" example.

0 Kudos
Message 6 of 9
(7,338 Views)

Hi,

Yes I Know and I've done that before. But its not the issue, I need to use our player, It has feature Associated with our goal so I have to use it externally.

There is no way to communicate between the two?

0 Kudos
Message 7 of 9
(7,331 Views)
Solution
Accepted by topic author OmerK

OmerK,

 

I believe the best way to do what you're asking is to use a DIAdem script to make sure that playback for the data file and the external video player start at the same time. There is an object property in DIAdem that returns the start position for the playback cursor: http://zone.ni.com/reference/en-XX/help/370858K-01/scriptview/properties/view_property_startpos_itoc...

 

You could use the GPI toolkit to create a DLL which either interfaces directly with your external video player or calls into a "middle man" C program to handle communication between the two programs. Here's a link to a help file about the GPI toolkit: http://zone.ni.com/reference/en-XX/help/370858K-01/genshell/genshell/gpi/

 

Once the timestamp between the two programs is synchronized, you need to start playback of the data files and the video at the same time. From the DIAdem perspective, you can use the cursor object's Play command: http://zone.ni.com/reference/en-XX/help/370858K-01/scriptview/methods/view_method_play_itocursormast... Starting the two playbacks at the same time and the same timestamp should cause them to playback in sync, assuming the video and data file are playing back at the same rate (data file playback speed can be configured in DIAdem as well).

 

Of course, this won't allow you to grab the cursor and scrub through the data file and maintain the synchronization. You could use an event in DIAdem scripting to catch cursor movement and update your timestamp based on that: http://zone.ni.com/reference/en-XX/help/370858K-01/scriptview/properties/view_property_oncursorchang...   However, it will be difficult to continually synchronize between the programs due to performance issues (communication would need to occur fast enough to avoid jitter between the video and data file).

 

 

 

The short answer here is that it's a tall order to keep DIAdem playback synchronized to another application, and while it might be possible to achieve simultaneous start, it's going to be a challenge to keep the two playbacks synchronized. 

Message 8 of 9
(7,310 Views)

Sounds great.

I haven't figured out how to use this GPI thing yet.. But I'm working on it.

I hope it will be the solution.

 

Thank you Daniel, you are a true hero and you should feel proud!

0 Kudos
Message 9 of 9
(7,276 Views)