@ray-js/ipc-player-integration 0.0.53-beta.13 → 0.0.53-beta.14

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.
package/lib/utils/ttt.js CHANGED
@@ -136,7 +136,10 @@ export function notifyOfflineShown(deviceId) {
136
136
  }
137
137
  try {
138
138
  console.warn('res===notifyOfflineShown', deviceId);
139
- method(deviceId, 'preview_mini');
139
+ method({
140
+ deviceId,
141
+ scene: 'preview_mini'
142
+ });
140
143
  return true;
141
144
  } catch (error) {
142
145
  return false;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import { notifyOfflineShown } from './ttt';
2
+ jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({
3
+ ClarityType: {}
4
+ }));
5
+ describe('notifyOfflineShown', () => {
6
+ const originalTy = globalThis.ty;
7
+ afterEach(() => {
8
+ globalThis.ty = originalTy;
9
+ });
10
+ it('passes the device ID and scene as one object to the TTT method', () => {
11
+ const nativeNotify = jest.fn();
12
+ globalThis.ty = {
13
+ ipc: {
14
+ notifyOfflineShown: nativeNotify
15
+ }
16
+ };
17
+ expect(notifyOfflineShown('camera-1')).toBe(true);
18
+ expect(nativeNotify).toHaveBeenCalledTimes(1);
19
+ expect(nativeNotify).toHaveBeenCalledWith({
20
+ deviceId: 'camera-1',
21
+ scene: 'preview_mini'
22
+ });
23
+ });
24
+ it('skips hosts without the TTT method', () => {
25
+ globalThis.ty = {
26
+ ipc: {}
27
+ };
28
+ expect(notifyOfflineShown('camera-1')).toBe(false);
29
+ });
30
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.53-beta.13",
3
+ "version": "0.0.53-beta.14",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [