downloadStream

版本要求:
P2PKit≥2.0.2@ray-js/ray≥1.3.15
支持平台:
iOSAndroid
import { p2p } from '@ray-js/ray';

const { downloadStream } = p2p;

// Promise 调用
try {
  const res = await downloadStream({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

方法签名
downloadStream(params: )
SDK 最低版本
iOSThingSmartP2PKitBizBundle
≥ 5.2.0
Androidcom.thingclips.smart:thingsmart-bizbundle-p2pkit
≥ 5.2.0

描述

download file stream

参数

属性类型必填说明SDK 最低版本
deviceIdstring是device id—
albumNamestring是albumName given by the device—
jsonfilesstring是file name jsons,eg: {"files":["filesname1", "filesname2", "filesname3" ]}—
complete() => void否接口调用结束的回调函数(调用成功、失败都会执行)—
success() => void否接口调用成功的回调函数—
fail(params: Object) => void否接口调用失败的回调函数—
fail 回调参数
属性类型说明
errorMsgstring错误信息
errorCodestring | number错误码
错误扩展

返回值

无

示例代码

import { p2p } from '@ray-js/ray'

p2p.downloadStream({
  deviceId: "xx",
  albumName: "xx",
  jsonfiles: "xx",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});