@umituz/react-native-video-editor 1.0.8 → 1.0.10

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.8",
3
+ "version": "1.0.10",
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",
@@ -11,16 +11,16 @@ declare const __DEV__: boolean;
11
11
  * Safely play video with error handling
12
12
  */
13
13
  export const safePlay = (player: VideoPlayer | null): boolean => {
14
+ console.log("[safePlay] called, player:", !!player);
14
15
  if (!player) return false;
15
16
 
16
17
  try {
18
+ console.log("[safePlay] calling player.play()");
17
19
  player.play();
20
+ console.log("[safePlay] player.play() called successfully");
18
21
  return true;
19
22
  } catch (error) {
20
- if (typeof __DEV__ !== "undefined" && __DEV__) {
21
- // eslint-disable-next-line no-console
22
- console.log("[VideoPlayer] Play error ignored:", error);
23
- }
23
+ console.log("[safePlay] Play error:", error);
24
24
  return false;
25
25
  }
26
26
  };
@@ -3,7 +3,7 @@
3
3
  * Reusable video player with thumbnail and controls
4
4
  */
5
5
 
6
- import React, { useState, useCallback, useMemo } from "react";
6
+ import React, { useState, useCallback, useMemo, useEffect } from "react";
7
7
  import {
8
8
  View,
9
9
  TouchableOpacity,
@@ -33,13 +33,22 @@ export const VideoPlayer: React.FC<VideoPlayerProps> = ({
33
33
  const { width } = useWindowDimensions();
34
34
  const [showVideo, setShowVideo] = useState(autoPlay);
35
35
 
36
- const { player, state } = useVideoPlayerControl({
37
- source: showVideo ? source : null,
36
+ // Always pass source to player - control visibility separately
37
+ const { player, state, controls } = useVideoPlayerControl({
38
+ source,
38
39
  loop,
39
40
  muted,
40
- autoPlay,
41
+ autoPlay: false,
41
42
  });
42
43
 
44
+ // Auto-play when user clicks play button
45
+ useEffect(() => {
46
+ if (showVideo && state.isPlayerValid && player) {
47
+ console.log("[VideoPlayer] Starting playback...");
48
+ controls.play();
49
+ }
50
+ }, [showVideo, state.isPlayerValid, player, controls]);
51
+
43
52
  const handlePlay = useCallback(() => {
44
53
  console.log("[VideoPlayer] handlePlay called, source:", source);
45
54
  setShowVideo(true);
@@ -31,7 +31,8 @@ export const useVideoPlayerControl = (
31
31
  const [isPlaying, setIsPlaying] = useState(false);
32
32
  const [isLoading, setIsLoading] = useState(true);
33
33
 
34
- const player = useExpoVideoPlayer(source ?? "", (p) => {
34
+ const player = useExpoVideoPlayer(source || "", (p) => {
35
+ console.log("[useVideoPlayerControl] Player callback, source:", source, "player:", !!p);
35
36
  if (source && p) {
36
37
  configurePlayer(p, { loop, muted, autoPlay });
37
38
  setIsLoading(false);