LM视频中间件登陆说明

登录流程

登陆API接口参见这里,登陆流程如图示:

LM视频中间件登陆说明_第1张图片

  1. 向LM视频中间件发送登录消息,消息携带用户名、密码(二次MD5加密);
  2. 登录成功,LM视频中间件返回唯一token串;
  3. 成功收到token后,开启定时器(周期60秒),把token串放入HTTP URL Query参数列表中,向LM视频中间发送保活消息;
  4. 通过token与LM视频中间通信,操作资源、实时视频、历史回放等;
  5. 调用登出接口,释放用户资源。

注意

  • LM返回的token具有唯一性

  • 第三方应用在获取到token后,务必进行第三步定时保活,否则180秒后,平台会释放token资源,导致接口调用失败或者正在播放、回放的视频异常断开

  • 第五步登出接口,非必须调用,LM平台在心跳周期内没有收到保活消息,会自动释放资源

消息示例

登录消息

请求
用户名:admin
密 码:admin
两次MD5加密后:c3284d0f94606de1fd2af172aba15bf3

    GET http://192.168.3.23:9030/api/v1/login?username=admin==&password=c3284d0f94606de1fd2af172aba15bf3 HTTP/1.1          
    User-Agent: PostmanRuntime/7.29.2          
    Accept: */*          
    Postman-Token: fd3c0945-d5cc-46df-8433-525ecd85e07c          
    Host: 192.168.3.23:9030         
    Accept-Encoding: gzip, deflate         
    Connection: keep-alive    

!!! info “应答”

  • 成功
      HTTP/1.1 200 OK
      Server: nginx
      Content-Type: application/json
      Content-Length: 129
      Connection: keep-alive
      Session: 25aefbab-a87c-49b5-9419-b5345e274351
      Access-Control-Allow-Origin: *

      {
          "result": 200,
          "message": "OK",
          "Token": "25aefbab-a87c-49b5-9419-b5345e274351",
          "Expires": 60,
          "userId": 2
      }    
  • 失败
     HTTP/1.1 422 invalid password
     Server: nginx
     Content-Type: application/json
     Content-Length: 108
     Connection: keep-alive
     Access-Control-Allow-Origin: *

     {
         "result": 422,
         "message": "invalid password",
         "Token": "",
         "Expires": 0,
         "userId": 0
     }

保活消息

请求
保活请求不需要携带 用户名密码 参数,但是需要把登录成功返回的 token 当作URL Query参数中发送至LM视频中间件
示例中返回的token:25aefbab-a87c-49b5-9419-b5345e274351

    GET http://192.168.3.23:9030/api/v1/login?token=25aefbab-a87c-49b5-9419-b5345e274351 HTTP/1.1
    User-Agent: PostmanRuntime/7.29.2
    Accept: */*
    Postman-Token: 19420ea2-fb6b-490d-a7b3-e79d47471a20
    Host: 192.168.3.23:9030
    Accept-Encoding: gzip, deflate, br
    Connection: keep-alive    

应答

  • 成功
    HTTP/1.1 200 OK
    Server: nginx
    Content-Type: application/json
    Content-Length: 131
    Connection: keep-alive
    Session: 0892f7c2-3a34-4a65-b866-5a4c5895bd42
    Access-Control-Allow-Origin: *
    
    {
        "result": 200,
        "message": "OK",
        "Token": "0892f7c2-3a34-4a65-b866-5a4c5895bd42",
        "Expires": 60,
        "userId": 0
    }    
    
  • 失败
    HTTP/1.1 424 user not login
    Server: nginx
    Content-Type: application/json
    Content-Length: 106
    Connection: keep-alive
    Access-Control-Allow-Origin: *
    
    {
        "result": 424,
        "message": "user not login",
        "Token": "",
        "Expires": 0,
        "userId": 0
    }
    

常见错误码

result message 说明
200 OK 成功
421 user not existed 用户不存在
422 invalid password 密码错误
423 invalid server 服务错误或授权到期
424 user not login 用户未登录

你可能感兴趣的:(安防视频直播,无插件视频,视频平台,网络,音视频,视频)