Control playback of svo files in unity

Hi all, i have a question regarding the SDK for Unity.
For a project we need to load multiple .svo files as well as starting a camera at the same time. However we noticed that different files start not at the same time but consequently and it seems to be not consistent.
Is there a way to control the play back of the svo files in unity? Will be possible to load the files and then play, stop and pause them?

Hi @bert85, welcome to the forums!

I made a quick example of this kind of setup. It relies on the pauseSVOReading bool attribute of ZEDManager, used to pause the SVO, and the SetSVOPosition(int) method that sets a SVO to a specific frame.
In my scene, I have 4 zed managers, 3 of them run a SVO and one a USB camera. Important thing: set the USB camera IDs to be the first ones (like 1, 2…). All the camera IDs should be different. So in my setup, USB zed is 1, and the SVO readers are 2, 3, 4.

Then I use this script and reference each ZEDManager of the SVO readers in it.

The scene is based on the Multi Cam example.

public class PausePlayManager : MonoBehaviour
    public ZEDManager zm1;
    public ZEDManager zm2;
    public ZEDManager zm3;

    public KeyCode togglePause1 = KeyCode.Keypad1;
    public KeyCode togglePause2 = KeyCode.Keypad2;
    public KeyCode togglePause3 = KeyCode.Keypad3;
    public KeyCode resetSVOs = KeyCode.Keypad0;

    private bool pause1 = true;
    private bool pause2 = true;
    private bool pause3 = true;

    // Pause the SVO at the beginning (if those vals are set to false, it will start sequentially)
    private void Start()
        zm1.pauseSVOReading = pause1;
        zm2.pauseSVOReading = pause2;
        zm3.pauseSVOReading = pause3;

    private void Update()
        // Pause or play the SVO
        if (Input.GetKeyDown(togglePause1)) { pause1 = !pause1; zm1.pauseSVOReading = pause1; }
        if (Input.GetKeyDown(togglePause2)) { pause2 = !pause2; zm2.pauseSVOReading = pause2; }
        if (Input.GetKeyDown(togglePause3)) { pause3 = !pause3; zm3.pauseSVOReading = pause3; }
        // Reset / Synchronize SVO
        if (Input.GetKeyDown(resetSVOs)) { zm1.zedCamera.SetSVOPosition(0); zm2.zedCamera.SetSVOPosition(0); zm3.zedCamera.SetSVOPosition(0); }

Do not hesitate if you have more questions.


Hi @JPlou thank you very much, I probably overlooked some of these functions. Great you pointed me at these.
Your example really helped us!

1 Like