@ray-js/lock-sdk 1.2.0-beta.7 → 1.2.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,4 +28,9 @@ export declare const getIPCConfig: (devId: string) => Promise<{
28
28
  hardwareCapability: number[];
29
29
  };
30
30
  }>;
31
+ export interface MediaViewTimesResult {
32
+ count: number;
33
+ }
34
+ export declare const getMediaViewTimes: (devId: string) => Promise<MediaViewTimesResult>;
35
+ export declare const setMediaViewTimes: (devId: string) => Promise<MediaViewTimesResult>;
31
36
  export {};
package/lib/api/video.js CHANGED
@@ -30,3 +30,23 @@ export const getIPCConfig = (devId) => {
30
30
  },
31
31
  });
32
32
  };
33
+ export const getMediaViewTimes = (devId) => {
34
+ return requestApi({
35
+ logName: "getMediaViewTimes",
36
+ api: `${THING}.m.device.lock.media.view.times.get`,
37
+ version: "1.0",
38
+ data: {
39
+ devId,
40
+ },
41
+ });
42
+ };
43
+ export const setMediaViewTimes = (devId) => {
44
+ return requestApi({
45
+ logName: "setMediaViewTimes",
46
+ api: `${THING}.m.device.lock.media.view.times.set`,
47
+ version: "1.0",
48
+ data: {
49
+ devId,
50
+ },
51
+ });
52
+ };
@@ -9,3 +9,5 @@ export declare function isSupportMultiCamera(): boolean;
9
9
  export declare function getCameraInfo(): import("../../../feature/media/camera").CameraInfo | undefined;
10
10
  export declare function queryCameraInfo(): Promise<import("../../../feature/media/camera").CameraInfo | undefined>;
11
11
  export declare function switchCamera(index: number): Promise<true>;
12
+ export declare function getMediaViewTimes(): Promise<import("../../../api/video").MediaViewTimesResult>;
13
+ export declare function addMediaViewTimes(): Promise<import("../../../api/video").MediaViewTimesResult>;
@@ -1,5 +1,5 @@
1
1
  import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
2
- import { getMediaUrlForRuntime, isSupportMediaForRuntime, openLocalAlbumForRuntime, gotoPlaybackForRuntime, getMediaInfoForRuntime, } from "../../../feature/media/media";
2
+ import { getMediaUrlForRuntime, isSupportMediaForRuntime, openLocalAlbumForRuntime, gotoPlaybackForRuntime, getMediaInfoForRuntime, getMediaViewTimesForRuntime, setMediaViewTimesForRuntime, } from "../../../feature/media/media";
3
3
  import { getMediaRotateForRuntime } from "../../../feature/media/rotate";
4
4
  import { isSupportMultiCameraForRuntime, getCameraInfoForRuntime, queryCameraInfoForRuntime, switchCameraForRuntime, } from "../../../feature/media/camera";
5
5
  export async function getMediaUrl(params) {
@@ -32,3 +32,9 @@ export async function queryCameraInfo() {
32
32
  export async function switchCamera(index) {
33
33
  return switchCameraForRuntime(resolveRuntimeFromExportThis(this), index);
34
34
  }
35
+ export async function getMediaViewTimes() {
36
+ return getMediaViewTimesForRuntime(resolveRuntimeFromExportThis(this));
37
+ }
38
+ export async function addMediaViewTimes() {
39
+ return setMediaViewTimesForRuntime(resolveRuntimeFromExportThis(this));
40
+ }
@@ -1,4 +1,5 @@
1
1
  import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ import { MediaViewTimesResult } from "../../api/video";
2
3
  export interface GetMediaUrlParams {
3
4
  mediaPath: string;
4
5
  mediaBucket: string;
@@ -35,3 +36,5 @@ export interface MediaInfo {
35
36
  isTwoWayTalk: boolean;
36
37
  }
37
38
  export declare const getMediaInfoForRuntime: (runtime: LockDeviceRuntime) => MediaInfo;
39
+ export declare const getMediaViewTimesForRuntime: (runtime: LockDeviceRuntime) => Promise<MediaViewTimesResult>;
40
+ export declare const setMediaViewTimesForRuntime: (runtime: LockDeviceRuntime) => Promise<MediaViewTimesResult>;
@@ -4,6 +4,7 @@ import dpCodes from "../../config/dp-code";
4
4
  import { RotateType, VedioType } from "../../constant";
5
5
  import { isSupportShortLink } from "../../platform";
6
6
  import { getError } from "../../utils/errors";
7
+ import { getMediaViewTimes, setMediaViewTimes, } from "../../api/video";
7
8
  export const getMediaUrlForRuntime = async (runtime, params) => {
8
9
  const devId = runtime.config.devInfo.devId;
9
10
  if ("mediaPath" in params && "mediaBucket" in params) {
@@ -85,3 +86,9 @@ export const getMediaInfoForRuntime = (runtime) => {
85
86
  isTwoWayTalk: runtime.config.isTwoWayTalk,
86
87
  };
87
88
  };
89
+ export const getMediaViewTimesForRuntime = (runtime) => {
90
+ return getMediaViewTimes(runtime.config.devInfo.devId);
91
+ };
92
+ export const setMediaViewTimesForRuntime = (runtime) => {
93
+ return setMediaViewTimes(runtime.config.devInfo.devId);
94
+ };
@@ -84,8 +84,8 @@ export const initState = async (runtime) => {
84
84
  }
85
85
  else {
86
86
  try {
87
- const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
88
87
  runtime.config.supportTalk = true;
88
+ const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
89
89
  runtime.config.isTwoWayTalk = modeRes.talkbackMode === 2;
90
90
  sdkLog("info", "initState", "supportTalk", {
91
91
  devId,
@@ -99,7 +99,7 @@ export const initState = async (runtime) => {
99
99
  sdkLog("error", "initState", "supportTalk", {
100
100
  devId,
101
101
  duration: Date.now() - startedAt,
102
- data: {},
102
+ error: e,
103
103
  });
104
104
  }
105
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lock-sdk",
3
- "version": "1.2.0-beta.7",
3
+ "version": "1.2.0-beta.8",
4
4
  "files": [
5
5
  "lib",
6
6
  "LICENSE.md"