@ray-js/ipc-player-integration 0.0.1-beta-10 → 0.0.1-beta-12

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.
Files changed (2) hide show
  1. package/lib/ui/ui.js +16 -11
  2. package/package.json +1 -1
package/lib/ui/ui.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import React, { useRef, useMemo, useEffect, useCallback } from 'react';
3
- import { View, CoverView, getSystemInfoSync } from '@ray-js/ray';
3
+ import { View, CoverView, getSystemInfoSync, usePageEvent } from '@ray-js/ray';
4
4
  import clsx from 'clsx';
5
5
  import IPCPlayer from '@ray-js/ray-ipc-player';
6
6
  import { PlayState, PlayerStreamStatus } from '../interface';
@@ -31,6 +31,7 @@ const defaultCSSVariable = {
31
31
  };
32
32
  const HIDE_COMPONENT_TIME = 5000;
33
33
  export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
34
+ console.log(props, 'props');
34
35
  const {
35
36
  className,
36
37
  devId,
@@ -38,8 +39,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
38
39
  CSSVariable = defaultCSSVariable
39
40
  } = props;
40
41
  const instance = getCtxInstance(props.instance, devId);
42
+ console.log(instance, 'instance');
41
43
  const {
42
- setPlayState
44
+ setPlayState,
45
+ setScreenType
43
46
  } = instance;
44
47
  const prevTriggerEvent = useRef();
45
48
  const eventRef = useRef();
@@ -47,6 +50,17 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
47
50
  if (!eventRef.current) {
48
51
  eventRef.current = getEventInstance();
49
52
  }
53
+
54
+ /**
55
+ * 监听屏幕布局变化
56
+ */
57
+ usePageEvent('onResize', sizeData => {
58
+ const {
59
+ type
60
+ } = sizeData;
61
+ console.log('监听到屏幕布局变化', type);
62
+ setScreenType(type === 'landscape' ? 'full' : 'vertical');
63
+ });
50
64
  const systemInfo = useRef(null);
51
65
  if (!systemInfo.current) {
52
66
  systemInfo.current = getSystemInfoSync();
@@ -184,15 +198,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
184
198
  ty.hideToast();
185
199
  }, 3000);
186
200
  },
187
- onSessionDidDisconnected: data => {
188
- console.log(`sessionDidDisconnected事件: ${JSON.stringify(data)}`);
189
- ty.showToast({
190
- title: `sessionDidDisconnected事件: ${JSON.stringify(data)}`
191
- });
192
- setTimeout(() => {
193
- ty.hideToast();
194
- }, 3000);
195
- },
196
201
  onCameraPreviewFailure: data => {
197
202
  console.log(`onCameraPreviewFailure事件: ${JSON.stringify(data)}`);
198
203
  ty.showToast({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.1-beta-10",
3
+ "version": "0.0.1-beta-12",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [