@umituz/react-native-video-editor 1.0.7 → 1.0.9

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.7",
3
+ "version": "1.0.9",
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
  * 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,17 +33,25 @@ 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({
36
+ const { player, state, controls } = useVideoPlayerControl({
37
37
  source: showVideo ? source : null,
38
38
  loop,
39
39
  muted,
40
- autoPlay,
40
+ autoPlay: showVideo ? true : autoPlay,
41
41
  });
42
42
 
43
+ // Auto-play when video becomes visible
44
+ useEffect(() => {
45
+ if (showVideo && state.isPlayerValid && player) {
46
+ console.log("[VideoPlayer] Playing video...");
47
+ controls.play();
48
+ }
49
+ }, [showVideo, state.isPlayerValid, player, controls]);
50
+
43
51
  const handlePlay = useCallback(() => {
52
+ console.log("[VideoPlayer] handlePlay called, source:", source);
44
53
  setShowVideo(true);
45
- // Player will auto-configure with autoPlay from hook
46
- }, []);
54
+ }, [source]);
47
55
 
48
56
  const containerStyle = useMemo(() => ({
49
57
  width: "100%" as const,
@@ -93,8 +101,17 @@ export const VideoPlayer: React.FC<VideoPlayerProps> = ({
93
101
  [tokens]
94
102
  );
95
103
 
104
+ // Debug: Log player state
105
+ console.log("[VideoPlayer] state:", {
106
+ showVideo,
107
+ isPlayerValid: state.isPlayerValid,
108
+ hasPlayer: !!player,
109
+ source,
110
+ });
111
+
96
112
  // Show video player when playing
97
113
  if (showVideo && state.isPlayerValid && player) {
114
+ console.log("[VideoPlayer] Rendering VideoView");
98
115
  return (
99
116
  <View style={[containerStyle, style]}>
100
117
  <VideoView