@umituz/react-native-video-editor 1.0.8 → 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.8",
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,13 +33,21 @@ 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(() => {
44
52
  console.log("[VideoPlayer] handlePlay called, source:", source);
45
53
  setShowVideo(true);