@predy-js/render-interface 0.3.3-beta.32 → 0.3.3-beta.35

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/dist/statistic.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Name: @predy-js/render-interface
3
3
  * Description: undefined
4
4
  * Author: undefined
5
- * Version: v0.3.3-beta.32
5
+ * Version: v0.3.3-beta.35
6
6
  */
7
7
 
8
8
  // https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js
@@ -4,3 +4,19 @@ export declare enum DestroyOptions {
4
4
  keep = 1,
5
5
  force = 0
6
6
  }
7
+ export declare enum PredyTextEncoding {
8
+ utf8 = 0,
9
+ ascii = 1
10
+ }
11
+ export declare enum PredyVideoCodec {
12
+ h264 = "avc1",
13
+ h265 = "hev1",
14
+ av1 = "av1"
15
+ }
16
+ export declare enum PredyResourceCacheStatus {
17
+ noCache = 0,
18
+ cached = 1,
19
+ preloaded = 2,
20
+ hitCDN = 3,
21
+ missCDN = 4
22
+ }
@@ -5,6 +5,7 @@ import type { PredyResizeTemplate, SDFImageOptions, SDFImage } from '@predy-js/s
5
5
  import type { ImageBitmapInternal } from './ImageBitmapInternal';
6
6
  import type { PredyVideoDecoder, PredyVideoDecoderConstructor } from './VideoDecoder';
7
7
  import type { ResourcePlatform } from './ResourceInternal';
8
+ import type { PredyVideoCodec, PredyTextEncoding, PredyResourceCacheStatus } from '../constants';
8
9
  export interface PredyRequestOptions {
9
10
  url: string;
10
11
  disableCache?: boolean;
@@ -12,13 +13,6 @@ export interface PredyRequestOptions {
12
13
  responseType?: 'text' | 'arraybuffer';
13
14
  useSystemNetwork?: boolean;
14
15
  }
15
- export declare enum PredyResourceCacheStatus {
16
- noCache = 0,
17
- cached = 1,
18
- preloaded = 2,
19
- hitCDN = 3,
20
- missCDN = 4
21
- }
22
16
  export interface PredyRequestResponse {
23
17
  data: ArrayBuffer | string;
24
18
  cacheStatus: PredyResourceCacheStatus;
@@ -27,15 +21,6 @@ export interface PredyRequestResponse {
27
21
  export type PredyRequestCallback = (err: string | undefined, res: PredyRequestResponse) => void;
28
22
  export declare const DataCompressMethodZlib = 1;
29
23
  type DataCompressMethod = typeof DataCompressMethodZlib;
30
- export declare enum PredyTextEncoding {
31
- utf8 = 0,
32
- ascii = 1
33
- }
34
- export declare enum PredyVideoCodec {
35
- h264 = "avc1",
36
- h265 = "hev1",
37
- av1 = "av1"
38
- }
39
24
  export interface PredyNativeInternal {
40
25
  webpDisabled?: boolean;
41
26
  /**
@@ -1,4 +1,5 @@
1
1
  import type { VideoFrameFormat } from '@predy-js/specification';
2
+ import type { PredyResourceCacheStatus } from '../constants';
2
3
  export interface PredyVideoDecoderFrameData {
3
4
  width: number;
4
5
  height: number;
@@ -23,6 +24,7 @@ export interface PredyVideoDecoderMetadata {
23
24
  height: number;
24
25
  duration: number;
25
26
  frameCount: number;
27
+ cacheStatus: PredyResourceCacheStatus;
26
28
  format: VideoFrameFormat;
27
29
  frameBufferSize: number;
28
30
  }
@@ -40,9 +42,9 @@ export interface PredyVideoDecoder {
40
42
  readonly status: PredyVideoDecoderStatus;
41
43
  readonly metadata?: PredyVideoDecoderMetadata;
42
44
  /**
43
- * 只做资源请求,不进行视频解码,
44
- * 这种情况下,seekFrame永远返回error(prefetch only)
45
- */
45
+ * 只做资源请求,不进行视频解码,
46
+ * 这种情况下,seekFrame永远返回error(prefetch only)
47
+ */
46
48
  readonly prefetchOnly: boolean;
47
49
  /**
48
50
  * 是否要跳播/回播,如果不需要的话,Decoder可以自行释放已经播放的帧
@@ -57,9 +59,9 @@ export interface PredyVideoDecoder {
57
59
  */
58
60
  loadVideo(url: string, callback: PredyVideoDecoderLoadedCallback): void;
59
61
  /**
60
- * 如果当前正在解析,中断解析,并且之前的callback返回error(abort)
61
- * 调用后回到frameReady状态
62
- */
62
+ * 如果当前正在解析,中断解析,并且之前的callback返回error(abort)
63
+ * 调用后回到frameReady状态
64
+ */
63
65
  abortSeeking(): void;
64
66
  /**
65
67
  * 解析视频的下一帧,获得图像数据。如果调用的时候正在解析,callback直接返回error
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predy-js/render-interface",
3
- "version": "0.3.3-beta.32",
3
+ "version": "0.3.3-beta.35",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -5,3 +5,23 @@ export enum DestroyOptions {
5
5
  keep = 1,
6
6
  force = destroy,
7
7
  }
8
+
9
+ export enum PredyTextEncoding {
10
+ utf8 = 0,
11
+ ascii = 1,
12
+ }
13
+
14
+ export enum PredyVideoCodec {
15
+ h264 = 'avc1',
16
+ h265 = 'hev1',
17
+ av1 = 'av1'
18
+ }
19
+
20
+ export enum PredyResourceCacheStatus {
21
+ noCache = 0, // 没有缓存,走网络请求
22
+ cached = 1, // 命中缓存,如果请求同一个url,在关闭APP之前,一定会命中缓存,关闭APP后,清理时间由系统决定
23
+ preloaded = 2, // 命中预推
24
+ hitCDN = 3, // 从正常CDN加载
25
+ missCDN = 4, // CDN异常加载(回源)
26
+ }
27
+
@@ -5,6 +5,7 @@ import type { PredyResizeTemplate, SDFImageOptions, SDFImage } from '@predy-js/s
5
5
  import type { ImageBitmapInternal } from './ImageBitmapInternal';
6
6
  import type { PredyVideoDecoder, PredyVideoDecoderConstructor } from './VideoDecoder';
7
7
  import type { ResourcePlatform } from './ResourceInternal';
8
+ import type { PredyVideoCodec, PredyTextEncoding, PredyResourceCacheStatus } from '../constants';
8
9
 
9
10
  export interface PredyRequestOptions {
10
11
  url: string,
@@ -19,14 +20,6 @@ export interface PredyRequestOptions {
19
20
  useSystemNetwork?: boolean,
20
21
  }
21
22
 
22
- export enum PredyResourceCacheStatus {
23
- noCache = 0, // 没有缓存,走网络请求
24
- cached = 1, // 命中缓存,如果请求同一个url,在关闭APP之前,一定会命中缓存,关闭APP后,清理时间由系统决定
25
- preloaded = 2, // 命中预推
26
- hitCDN = 3, // 从正常CDN加载
27
- missCDN = 4, // CDN异常加载(回源)
28
- }
29
-
30
23
  export interface PredyRequestResponse {
31
24
  data: ArrayBuffer | string,
32
25
  cacheStatus: PredyResourceCacheStatus,
@@ -39,17 +32,6 @@ export const DataCompressMethodZlib = 1;
39
32
 
40
33
  type DataCompressMethod = typeof DataCompressMethodZlib;
41
34
 
42
- export enum PredyTextEncoding {
43
- utf8 = 0,
44
- ascii = 1,
45
- }
46
-
47
- export enum PredyVideoCodec {
48
- h264 = 'avc1',
49
- h265 = 'hev1',
50
- av1 = 'av1'
51
- }
52
-
53
35
  export interface PredyNativeInternal {
54
36
  webpDisabled?: boolean,
55
37
  /**
@@ -1,5 +1,5 @@
1
1
  import type { VideoFrameFormat } from '@predy-js/specification';
2
-
2
+ import type { PredyResourceCacheStatus } from '../constants';
3
3
  export interface PredyVideoDecoderFrameData {
4
4
  width: number,
5
5
  height: number,
@@ -24,8 +24,9 @@ export enum PredyVideoDecoderStatus {
24
24
  export interface PredyVideoDecoderMetadata {
25
25
  width: number,
26
26
  height: number,
27
- duration: number,
27
+ duration: number, // in ms
28
28
  frameCount: number,
29
+ cacheStatus: PredyResourceCacheStatus,
29
30
  format: VideoFrameFormat,
30
31
  frameBufferSize: number, // 每帧的buffer大小
31
32
  }
@@ -47,9 +48,9 @@ export interface PredyVideoDecoder {
47
48
  readonly metadata?: PredyVideoDecoderMetadata,
48
49
 
49
50
  /**
50
- * 只做资源请求,不进行视频解码,
51
- * 这种情况下,seekFrame永远返回error(prefetch only)
52
- */
51
+ * 只做资源请求,不进行视频解码,
52
+ * 这种情况下,seekFrame永远返回error(prefetch only)
53
+ */
53
54
  readonly prefetchOnly: boolean,
54
55
  /**
55
56
  * 是否要跳播/回播,如果不需要的话,Decoder可以自行释放已经播放的帧
@@ -66,10 +67,11 @@ export interface PredyVideoDecoder {
66
67
  loadVideo(url: string, callback: PredyVideoDecoderLoadedCallback): void,
67
68
 
68
69
  /**
69
- * 如果当前正在解析,中断解析,并且之前的callback返回error(abort)
70
- * 调用后回到frameReady状态
71
- */
70
+ * 如果当前正在解析,中断解析,并且之前的callback返回error(abort)
71
+ * 调用后回到frameReady状态
72
+ */
72
73
  abortSeeking(): void,
74
+
73
75
  /**
74
76
  * 解析视频的下一帧,获得图像数据。如果调用的时候正在解析,callback直接返回error
75
77
  * @param frameIndex frame的index