Skip to content
This SDK only works with devices released within the past 3 years. We regularly optimize and update the SDK to ensure compatibility and performance. We do not guarantee compatibility or provide technical support for devices older than 3 years.

# Video Record

Remote start and stop manual recording is available (N9000 only).

## Interface Overview

interface Name | Functional Description
--- | ---
`NET_SDK_StartDVRRecord` | Remote manual start device recording (N9000 only).
`NET_SDK_StopDVRRecord` | Remote manual stop device recording (N9000 only).

## Process Description

    ---
    title: Video Recording
    ---

    flowchart TD
        A(Device SDK initialization <br><strong>NET_SDK_Init</strong>)
        B(User registers device <br><strong>NET_SDK_Login</strong> or <br><strong>NET_SDK_LoginEx</strong>)
        C("Start manual recording on the device <br><strong>NET_SDK_StartDVRRecord</strong>")
        D("Stop manual recording on the device <br><strong>NET_SDK_StopDVRRecord</strong>")
        E(Log out of device <br><strong>NET_SDK_Logout</strong>)
        F(Release SDK resources <br><strong>NET_SDK_Cleanup</strong>)

        B --> C --> E
        A --> B --> D --> E --> F

Note

Video recording function, providing manual recording and stop device recording function, only N9000 support.

## Sample Code

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    #include <afx.h>
    #include <string>
    #include <stdio.h>
    #include <iostream>
    #include "DVR_NET_SDK.h"

    void StartRecord()
    {
        // Device information.
        const std::string device_ip = "10.80.1.177";
        const DWORD decice_port = 6036;
        const std::string username = "admin";
        const std::string password = "123456";
        // Initialize SDK.
        NET_SDK_Init();
        NET_SDK_DEVICEINFO device_info{0};
        DWORD errCode = 0;
        // Device login.
        int userid = NET_SDK_Login(const_cast<char *>(device_ip.c_str()), decice_port, const_cast<char *>(username.c_str()), const_cast<char *>(password.c_str()), &device_info);

        if (userid > 0)
        {
            std::cout << "Login successful!" << std::endl;
        }
        else
        {
            errCode = NET_SDK_GetLastError();
            std::cout << "Login failed!" << "Error code:" << errCode << std::endl;
            NET_SDK_Cleanup();
            return;
        }

        // Manually recording.
        BOOL ret = NET_SDK_StartDVRRecord(userid, 0, 0);

        if (ret)
        {
            std::cout << "Manual recording successful!" << std::endl;
        }
        else
        {
            errCode = NET_SDK_GetLastError();
            std::cout << "Manual recording failed!" << "Error code:" << errCode << std::endl;
        }

        // Logout.
        NET_SDK_Logout(userid);
        // Release SDK resources.
        NET_SDK_Cleanup();
        return;
    }

Error Code