react-native-vlc-media-player icon indicating copy to clipboard operation
react-native-vlc-media-player copied to clipboard

Invariant Violation: requireNativeComponent: "RCTVLCPlayer" was not found in the UIManager.

Open ogeanvictor opened this issue 2 years ago • 15 comments

Using expo, I've done the mentioned steps on README but I'm still getting this error.

image

ogeanvictor avatar Sep 18 '23 16:09 ogeanvictor

the same error, any solution?

danielakarwowska avatar Oct 05 '23 11:10 danielakarwowska

Fix issue: First install expo-dev-client : npx expo install expo-dev-client.

VLCPlayer component is something like this:

`import { VLCPlayer } from 'react-native-vlc-media-player';

const calcVLCPlayerHeight = (windowWidth,aspetRatio) => { return windowWidth * aspetRatio; };

<VLCPlayer source={{ initType: 2, hwDecoderEnabled: 1, hwDecoderForced: 1, uri: 'rtsp://stream.com', initOptions: [ '--no-audio', '--rtsp-tcp', '--network-caching=150', '--rtsp-caching=150', '--no-stats', '--tcp-caching=150', '--realrtsp-caching=150', ], }} autoplay={true} autoAspectRatio={true} resizeMode="cover" isLive={true} autoReloadLive={true} style={{ height: calcVLCPlayerHeight( Dimensions.get('window').width, 3/4), marginTop: 30}} /> ` Behind make component, follow the steps:

  1. Make a development build in expo with npx expo prebuild --clean
  2. Run project with: npx expo run:android or npx expo run:ios. This builds your project according to your device. (Necessary a emulator android/ios)
  3. With any changes, you need to start your project with npx expo start --dev-client

Sorry my english, I hope this works.

ogeanvictor avatar Oct 05 '23 14:10 ogeanvictor

Omg, it works. Thank you so much, you've saved me 3 weeks of work. Thanks

danielakarwowska avatar Oct 06 '23 09:10 danielakarwowska

Fix issue: First install expo-dev-client : npx expo install expo-dev-client.

VLCPlayer component is something like this:

`import { VLCPlayer } from 'react-native-vlc-media-player';

const calcVLCPlayerHeight = (windowWidth,aspetRatio) => { return windowWidth * aspetRatio; };

<VLCPlayer source={{ initType: 2, hwDecoderEnabled: 1, hwDecoderForced: 1, uri: 'rtsp://stream.com', initOptions: [ '--no-audio', '--rtsp-tcp', '--network-caching=150', '--rtsp-caching=150', '--no-stats', '--tcp-caching=150', '--realrtsp-caching=150', ], }} autoplay={true} autoAspectRatio={true} resizeMode="cover" isLive={true} autoReloadLive={true} style={{ height: calcVLCPlayerHeight( Dimensions.get('window').width, 3/4), marginTop: 30}} /> ` Behind make component, follow the steps:

  1. Make a development build in expo with npx expo prebuild --clean
  2. Run project with: npx expo run:android or npx expo run:ios. This builds your project according to your device. (Necessary a emulator android/ios)
  3. With any changes, you need to start your project with npx expo start --dev-client

Sorry my english, I hope this works.

It works correctly on ios and android emulators but after publish (with command: eas update ). I've got the same error:requireNativeComponent: "RCTVLCPlayer" was not found in the UIManager.

Any idea why it doesn’t work after publish with expo on expo go app ?

igorbacz avatar Oct 10 '23 09:10 igorbacz

Fix issue: First install expo-dev-client : npx expo install expo-dev-client. VLCPlayer component is something like this: import { VLCPlayer } from 'react-native-vlc-media-player'; const calcVLCPlayerHeight = (windowWidth,aspetRatio) => { return windowWidth * aspetRatio; }; <VLCPlayer source={{ initType: 2, hwDecoderEnabled: 1, hwDecoderForced: 1, uri: 'rtsp://stream.com', initOptions: [ '--no-audio', '--rtsp-tcp', '--network-caching=150', '--rtsp-caching=150', '--no-stats', '--tcp-caching=150', '--realrtsp-caching=150', ], }} autoplay={true} autoAspectRatio={true} resizeMode="cover" isLive={true} autoReloadLive={true} style={{ height: calcVLCPlayerHeight( Dimensions.get('window').width, 3/4), marginTop: 30}} /> Behind make component, follow the steps:

  1. Make a development build in expo with npx expo prebuild --clean
  2. Run project with: npx expo run:android or npx expo run:ios. This builds your project according to your device. (Necessary a emulator android/ios)
  3. With any changes, you need to start your project with npx expo start --dev-client

Sorry my english, I hope this works.

It works correctly on ios and android emulators but after publish (with command: eas update ). I've got the same error:requireNativeComponent: "RCTVLCPlayer" was not found in the UIManager.

Any idea why it doesn’t work after publish with expo on expo go app ?

Its because when make a prebuild, and run project with npx expo run:android or npx expo run:ios project are ejected from expo go, 'cause expo go doesn't support native libs from react-native. The project running only on emulators with a development build.

If you notice when using the command npx expo start --dev-client , metro bundler starts the project in "development build" mode. And when you run the project in the emulator, an application is created for your project, not using expo.

ogeanvictor avatar Oct 10 '23 14:10 ogeanvictor

Hi. Please can anyone give me a sample code to run a video from url in vlcplayer, i am not much experienced in this, but really want to use it for my work, please anyone.

aisehiwebwala avatar Apr 03 '24 12:04 aisehiwebwala

import { VLCPlayer } from 'react-native-vlc-media-player';

const calcVLCPlayerHeight = (windowWidth,aspetRatio) => {
return windowWidth * aspetRatio;
};

<VLCPlayer
source={{
initType: 2,
hwDecoderEnabled: 1,
hwDecoderForced: 1,
uri:
'rtsp://stream.com',
initOptions: [
'--no-audio',
'--rtsp-tcp',
'--network-caching=150',
'--rtsp-caching=150',
'--no-stats',
'--tcp-caching=150',
'--realrtsp-caching=150',
],
}}
autoplay={true}
autoAspectRatio={true}
resizeMode="cover"
isLive={true}
autoReloadLive={true}
style={{ height: calcVLCPlayerHeight( Dimensions.get('window').width, 3/4), marginTop: 30}}
/>

Hi. Please can anyone give me a sample code to run a video from url in vlcplayer, i am not much experienced in this, but really want to use it for my work, please anyone.

ogeanvictor avatar Apr 03 '24 12:04 ogeanvictor

I tried npx expo prebuild --clean and then npx expo run:android but nothing worked .

Also, I built two different versions, with plugins in app.json and without plugins, and still got the same error on both builds.

Any suggestions?

Note that expo-dev-client is also installed

amjadmak avatar Apr 12 '24 16:04 amjadmak

I tried npx expo prebuild --clean and then npx expo run:android but nothing worked .

Also, I built two different versions, with plugins in app.json and without plugins, and still got the same error on both builds.

Any suggestions?

Note that expo-dev-client is also installed

you started project with npx expo start --dev-client ? what errors you got ?

ogeanvictor avatar Apr 12 '24 18:04 ogeanvictor

I tried npx expo prebuild --clean and then npx expo run:android but nothing worked . Also, I built two different versions, with plugins in app.json and without plugins, and still got the same error on both builds. Any suggestions? Note that expo-dev-client is also installed

you started project with npx expo start --dev-client ? what errors you got ?

I will be listing all things that I tried here:

1. when I run npx expo run:android the app will start automatically in the emulator

Here is what I see first: Untitled

2. When I try to start the app from Expo Go and import <VLCPlayer/> component I receive this : [Invariant Violation: requireNativeComponent: "RCTVLCPlayer" was not found in the UIManager.

3. When I use npx expo start --dev-client to open my development build, Here is what I got:

image

I just entered a whirl with no solution, any suggestions?

amjadmak avatar Apr 12 '24 19:04 amjadmak

hello, @amjadmak any update with your error? im getting the same error here :/

mvmmarcus avatar Apr 29 '24 15:04 mvmmarcus

Hey, @mvmmarcus . Unfortunately, no updates. I could not use it. I tried to use it for a hobby project, but since there is an error I just left the whole project.

I would like to see a solution though

amjadmak avatar Apr 29 '24 19:04 amjadmak

@amjadmak tks for feedback. I will abort expo and build app with CLI :/

mvmmarcus avatar Apr 29 '24 20:04 mvmmarcus

@mvmmarcus before aborting Expo, you can try two options.

  1. A different react native library that offers the same or similar feature.
  2. Degrade your current react native version. I read that it works fine with previous react native versions.

You can also go to the link Here and vote for adding an RTSP streaming library to Expo. I have seen a lot of people asking this but still not available

amjadmak avatar Apr 30 '24 05:04 amjadmak

Check how many versions of Expo you have in your package.json file. You can uninstall the libraries one by one and see if it works. Personally, I had the same problem. Upon carefully checking my package.json file, it turned out that I had 2 versions of Expo, both in dependencies and devDependencies.

danielakarwowska avatar Apr 30 '24 06:04 danielakarwowska