@umituz/react-native-video-editor 1.0.13 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-video-editor",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Professional video editor with layer-based timeline, text/image/shape/audio/animation layers, and export functionality",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -3,7 +3,7 @@
3
3
  * Main hook for video player control with safe operations
4
4
  */
5
5
 
6
- import { useState, useCallback, useMemo } from "react";
6
+ import { useState, useCallback, useMemo, useEffect } from "react";
7
7
  import { useVideoPlayer as useExpoVideoPlayer } from "expo-video";
8
8
 
9
9
  import type {
@@ -20,6 +20,8 @@ import {
20
20
  configurePlayer,
21
21
  } from "../../infrastructure/services/player-control.service";
22
22
 
23
+ declare const __DEV__: boolean;
24
+
23
25
  /**
24
26
  * Hook for managing video player with safe operations
25
27
  */
@@ -32,25 +34,55 @@ export const useVideoPlayerControl = (
32
34
  const [isLoading, setIsLoading] = useState(true);
33
35
 
34
36
  const player = useExpoVideoPlayer(source || "", (p) => {
35
- console.log("[useVideoPlayerControl] Player callback, source:", source, "player:", !!p);
37
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
38
+ // eslint-disable-next-line no-console
39
+ console.log("[useVideoPlayerControl] Player callback, source:", source, "player:", !!p);
40
+ }
36
41
  if (source && p) {
37
42
  configurePlayer(p, { loop, muted, autoPlay });
38
43
  setIsLoading(false);
39
44
  if (autoPlay) {
40
45
  setIsPlaying(true);
41
46
  }
42
- // Log player status for debugging
43
- console.log("[useVideoPlayerControl] Player status:", {
44
- currentTime: p.currentTime,
45
- duration: p.duration,
46
- status: p.status,
47
- playing: p.playing,
48
- muted: p.muted,
49
- volume: p.volume,
50
- });
47
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
48
+ // eslint-disable-next-line no-console
49
+ console.log("[useVideoPlayerControl] Player status:", {
50
+ currentTime: p.currentTime,
51
+ duration: p.duration,
52
+ status: p.status,
53
+ playing: p.playing,
54
+ muted: p.muted,
55
+ volume: p.volume,
56
+ });
57
+ }
51
58
  }
52
59
  });
53
60
 
61
+ // Listen to player status changes and errors
62
+ useEffect(() => {
63
+ if (!player) return;
64
+
65
+ const subscription = player.addListener("statusChange", ({ status, error }) => {
66
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
67
+ // eslint-disable-next-line no-console
68
+ console.log("[useVideoPlayerControl] Status changed:", status, "Error:", error);
69
+ }
70
+ if (status === "readyToPlay") {
71
+ setIsLoading(false);
72
+ }
73
+ if (error) {
74
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
75
+ // eslint-disable-next-line no-console
76
+ console.error("[useVideoPlayerControl] Player error:", error);
77
+ }
78
+ }
79
+ });
80
+
81
+ return () => {
82
+ subscription.remove();
83
+ };
84
+ }, [player]);
85
+
54
86
  const isPlayerValid = useMemo(
55
87
  () => isPlayerReady(player, source),
56
88
  [player, source],