birdwingo / react-native-instagram-stories

🚀 Instagram stories is a versatile React Native component designed to display a horizontal scrollable list of user stories, similar to the stories feature found in the Instagram app.
https://birdwingo.com
MIT License
120 stars 34 forks source link

Video url is not working in stories #96

Closed jazzylamba closed 1 month ago

jazzylamba commented 1 month ago

Rendering object is like @LukasFridmansky

[{id : "1" mediaType : "video" source :
uri : "https://media.oono.ai/uploads/videos/1721820328382_AE4CFC36-D7A8-4B27-81E5-1CAFD09B4263-26678-00000911B04DC472.mp4"}]

LukasFridmansky commented 1 month ago

Please, make sure you have installed react-native-video in your project

jazzylamba commented 1 month ago

yes, it is installed @LukasFridmansky

"react-native-video": "^6.4.2"

LukasFridmansky commented 1 month ago

Can you share your whole code? It seems to work fine for me

jazzylamba commented 1 month ago

@LukasFridmansky Here is the code

const getStoriesData = () => {
    return (
      data &&
      data?.map((item, index) => {
        return {
          id: `${item?.storyId}`,
          source: {
            uri: item?.url,
          },
          mediaType: item.backgroundType === 'VIDEO' ? 'video' : 'image',
        };
      })
    );
  };

  let userStoriesData = [
    {
      id: user?.userId,
      imgUrl:  user?.avatar,
      name: user?.fullName,
      stories: getStoriesData(),
    },
  ];

  <InstagramStories
        ref={instagramStoriesRef}
        isVisible={isVisible}
        stories={userStoriesData}
        imageStyles={{resizeMode: 'contain', height, aspectRatio: 1.5}}
        imageProps={{height, minHeight: height}}
        videoProps={{height, minHeight: height}}
        progressContainerStyle={{marginTop: 40}}
        headerContainerStyle={{marginTop: 40}}
        avatarBorderColors={[
          '#FBAA47',
          '#D91A46',
          '#D91A46',
          '#A60F93',
          '#A60F93',
        ]}
        avatarSeenBorderColors={[
          '#F7B801',
          '#F18701',
          '#F35B04',
          '#F5301E',
          '#C81D4E',
          '#8F1D4E',
        ]}
        closeIconColor={'white'}
        avatarListContainerStyle={[styles.hollowCircle]}
        avatarSize={73}
        animationDuration={7000}
        hideElementsOnLongPress={true}
        progressColor={'gray'}
        textStyle={{color: 'white'}}
        hideAvatarList={hideDisplay}
        avatarListContainerProps={{scrollEnabled: false}}
        storyImageStyle={{height: '100%', width: '100%', objectFit: 'cover'}}
        onStoryStart={(userId, story_id) => onSeenStory(userId, story_id)}
      />
jazzylamba commented 1 month ago

@LukasFridmansky

LukasFridmansky commented 1 month ago

I couldn't reproduce your issue. Are you sure all libraries are up to date? Can you please make a video/image of what you see? Is progress changing? Maybe you could try to remove some props? Like videoProps={{height, minHeight: height}}, what is height in your case? Maybe try use default styles and see if anything is working. Just use only stories in component and see if it works so I know if there is in issue with some of properties or stories theirselves.

jazzylamba commented 1 month ago

Yes @LukasFridmansky , that works