Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(ios)the same uri work in 3.0.0 but not work in 3.1.0 #1140

Closed
SHISME opened this issue Jul 19, 2018 · 15 comments
Closed

(ios)the same uri work in 3.0.0 but not work in 3.1.0 #1140

SHISME opened this issue Jul 19, 2018 · 15 comments

Comments

@SHISME
Copy link

SHISME commented Jul 19, 2018

Current behavior

When i upgrade from 3.0.0 to 3.1.0, the video can not load with the same uri, in 3.0.0 the uri is ok,but in 3.1.0 it not work, have something to mind before upgrade?

Platform

  • iphoneX iOS 11.4

Video sample

<Video
              source={{uri:audio_uri}}
              paused={!should_play}
              onLoad={this.on_load as any}
              onEnd={this.on_audio_end}
              onProgress={this.render_animate}
 />

@SHISME SHISME changed the title the same uri work in 3.0.0 but not work in 3.1.0 (ios)the same uri work in 3.0.0 but not work in 3.1.0 Jul 19, 2018
@cobarx
Copy link
Contributor

cobarx commented Jul 24, 2018

I will go ahead and test this to see if I can find any problems. Which uri are you using, I am guessing 3.1.0 has a bug for some files but not all.

@SHISME
Copy link
Author

SHISME commented Jul 25, 2018

hi cobarx, I use local resource, in 3.0.0 need use absolute path,but in 3.1.0 ,need use relative path

@cobarx
Copy link
Contributor

cobarx commented Jul 25, 2018

Can you give me an example of what that local resource looks like. I want to make sure I'm testing the right thing.

@SHISME
Copy link
Author

SHISME commented Jul 25, 2018

ok,i will make a simple example for you later

@SHISME
Copy link
Author

SHISME commented Jul 25, 2018

In my project the ios directory structure like this

├── rnVideoTest
│   ├── AppDelegate.h
│   ├── AppDelegate.m
│   ├── Base.lproj
│   ├── Images.xcassets
│   ├── Info.plist
│   ├── main.m
│   └── static
│       └── test.mp3

in early version, we need use the MainBundlePath in the uri can make it work

import React, {Component} from 'react';
import {
  StyleSheet,
  View,
} from 'react-native';
import Video from 'react-native-video';
import { MainBundlePath } from 'react-native-fs';


type Props = {};
export default class App extends Component<Props> {
  render() {
    console.warn('mainPath:', MainBundlePath);
    return (
      <View style={styles.container}>
        <Video
          source={{uri: MainBundlePath + '/static/test.mp3'}}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

But recently ,we update our version to 3.1.0, in 3.1.0, we use this relative path can work, if add MainBundlePath , it can't work

 <Video
          source={{uri: 'static/test.mp3'}}
        />

@SHISME
Copy link
Author

SHISME commented Jul 25, 2018

i found uri: 'static/test.mp3' also work in 3.0.0, our team's member tell me they use MainBundlePath because early version can't work with uri: 'static/test.mp3

@pontusab
Copy link

pontusab commented Jul 25, 2018

I have the same issue between 3.0.0 and 3.0.1
I just require a videolike this: import video from 'videos/splash.mp4'

and use the component like this: <Video source={video} muted resizeMode="cover" repeat />

@tibbus
Copy link

tibbus commented Aug 3, 2018

Same issue here, works on 3.0.0 but doesn't on 3.1.0 with a local uri

@pontusab
Copy link

pontusab commented Aug 4, 2018

For me it works with 3.0.1 in dev mode but not once released.

@cmmartin
Copy link
Contributor

cmmartin commented Aug 5, 2018

External URLs are working fine, but any local file does not load. The onLoadStart handler gets fired, but the onLoad never fires and the video never plays. Here is an example of a local url that I am using. These come directly from the photo gallery or are freshly recorded using the camera

file:///private/var/mobile/Containers/Data/Application/34586BB4-FDCF-4FF3-8FDF-5BE3D14C459F/tmp/26240B02-C706-4536-ACBF-08BA7C9A4E57.MOV

This exact code worked prior to upgrading

@cobarx
Copy link
Contributor

cobarx commented Aug 6, 2018

I just released version 3.2.0 which contains PR #1162 by @ashnfb for this problem. Let us know if that fixes it or not.

@pontusab
Copy link

pontusab commented Aug 6, 2018

Thanks @cobarx and @ashnfb, this now works perfectly. Awesome work and thanks for a great library!

@cobarx cobarx closed this as completed Aug 7, 2018
@mbret
Copy link

mbret commented Aug 7, 2018

Quick fix, thanks a lot :)

@unicornRainbows
Copy link

YOU amazing HEROS!!

@light-of-king
Copy link

3.2.0 is good use,but 3.2.1 & 3.1.0 is not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants