react-native-af-video-player icon indicating copy to clipboard operation
react-native-af-video-player copied to clipboard

Error while updating prop src

Open Sunkari16 opened this issue 7 years ago • 12 comments

07-26 04:04:09.618 1649-1649/com.app.manch E/unknown:ViewManager: Error while updating prop src java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:83) at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:132) at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:51) at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:32) at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:269) at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:200) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1085) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1056) at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29) at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:134) at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:105) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:933) at android.view.Choreographer.doCallbacks(Choreographer.java:747) at android.view.Choreographer.doFrame(Choreographer.java:679) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:921) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6642) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: com.facebook.react.bridge.NoSuchKeyException: requestHeaders at com.facebook.react.bridge.ReadableNativeMap.getNullableValue(ReadableNativeMap.java:135) at com.facebook.react.bridge.ReadableNativeMap.getNullableValue(ReadableNativeMap.java:139) at com.facebook.react.bridge.ReadableNativeMap.getMap(ReadableNativeMap.java:210) at com.facebook.react.bridge.ReadableNativeMap.getMap(ReadableNativeMap.java:23) at com.brentvatne.react.ReactVideoViewManager.setSrc(ReactVideoViewManager.java:101)

When creating an issue, please ensure that you provide as much information as you can. Issues with a basic description will sadly be ignored as it doesn't help diagnose the issue :(

If you don't help me, I can't help you ¯\_(ツ)_/¯

Here are some common things to include that can help your issue be diagnosed.

  • [x] react-native-af-video-player version: 0.2.1

  • [x] React Native version: 0.56

  • [x] OS: Android

  • [x] Has this issue already been raised? Not sure

  • [x] Have you clearly read and understood the Readme? Yes

  • [x] Code and explanation to replicate this issue: <Video url={posterSource} style={[{width: width}, styles.sourceHeight]} inlineOnly

  • [ ] Are there any console logs?

  • [x] Include Screeshots / Video: screenshot_1532558375

Sunkari16 avatar Jul 25 '18 22:07 Sunkari16

+1

locales-wellington avatar Aug 06 '18 00:08 locales-wellington

+1

rj9676564 avatar Aug 10 '18 08:08 rj9676564

+1

riza avatar Feb 09 '19 16:02 riza

+1 amk @riza

hto avatar Feb 12 '19 19:02 hto

I came across this issue recently and after lots and lots of frantic searching with no results, I finally found a solution. The java module is out of date, you want to go into com.brentvatne.react.ReactVideoView and ReactVideoViewManager and get rid of any and all references to mRequestHeaders or the associated key, PROP_SRC_HEADERS. They removed it on the iOS side but did not remove it on the Android side, and I guess at some point the underlying JS code got modified to no longer support it.

So, the files would be ReactVideoView.java and ReactVideoViewManager.java

randy-miller avatar Mar 07 '19 22:03 randy-miller

@randy-miller can you please explain this by files name because i can't get it what you trying to say Thank You

ArbazYousuf avatar Mar 15 '19 11:03 ArbazYousuf

^^^

Sorry, I got my wires crossed and referenced the wrong files. I edited in the filenames

randy-miller avatar Mar 19 '19 15:03 randy-miller

Cant able to fix the issue, please help

SupriyaGo avatar Dec 01 '19 06:12 SupriyaGo

it show the video but it doesn't work. has it been worked for you?

ahmedelsayed11 avatar Feb 04 '20 11:02 ahmedelsayed11

Using yarn, add a resolution to force this version of react-native-video:

"resolutions": {
    "react-native-video": "^5.0.2"
  }

and then add this patch https://github.com/abbasfreestyle/react-native-af-video-player/issues/51#issuecomment-596869777

and it should start working!

jeaniekarina avatar Mar 10 '20 02:03 jeaniekarina

@randy-miller solution works, You need to comment out all occurences of the following in the two files (ReactVideoView.java , ReactVideoViewManager.java) but on the react-native-video" package which is used to build this package "react-native-af-video-player" , as following :

` //private ReadableMap mRequestHeaders = null; ... public void setSrc(final String uriString, final String type, final boolean isNetwork, final boolean isAsset /, final ReadableMap requestHeaders/) { setSrc(uriString, type, isNetwork, isAsset, /requestHeaders,/ 0, 0); }

public void setSrc(final String uriString, final String type, final boolean isNetwork, final boolean isAsset, /*final ReadableMap requestHeaders,*/ final int expansionMainVersion, final int expansionPatchVersion) {

    mSrcUriString = uriString;
    mSrcType = type;
    mSrcIsNetwork = isNetwork;
    mSrcIsAsset = isAsset;
    //mRequestHeaders = requestHeaders;
    mMainVer = expansionMainVersion;
    mPatchVer = expansionPatchVersion;

.....

           /* if (mRequestHeaders != null) {
                headers.putAll(toStringMap(mRequestHeaders));
            }*/

.....

   // WritableMap wRequestHeaders = Arguments.createMap();
   // wRequestHeaders.merge(mRequestHeaders);

    src.putString(ReactVideoViewManager.PROP_SRC_URI, uriString);
    src.putString(ReactVideoViewManager.PROP_SRC_TYPE, type);
    //src.putMap(ReactVideoViewManager.PROP_SRC_HEADERS, wRequestHeaders);

.... @Override protected void onAttachedToWindow() { super.onAttachedToWindow();

    if(mMainVer>0) {
        setSrc(mSrcUriString, mSrcType, mSrcIsNetwork, mSrcIsAsset, /*mRequestHeaders ,*/ mMainVer, mPatchVer);
    }
    else {
        setSrc(mSrcUriString, mSrcType, mSrcIsNetwork, mSrcIsAsset /*,mRequestHeaders*/);
    }
    setKeepScreenOn(true);
}

..... `

and in ReactVideoViewManager.java : ... //public static final String PROP_SRC_HEADERS = "requestHeaders"; .... //src.getMap(PROP_SRC_HEADERS), ....

emothek avatar May 09 '20 14:05 emothek

@randy-miller solution works, You need to comment out all occurences of the following in the two files (ReactVideoView.java , ReactVideoViewManager.java) but on the react-native-video" package which is used to build this package "react-native-af-video-player" , as following :

` //private ReadableMap mRequestHeaders = null; ... public void setSrc(final String uriString, final String type, final boolean isNetwork, final boolean isAsset /, final ReadableMap requestHeaders/) { setSrc(uriString, type, isNetwork, isAsset, /requestHeaders,/ 0, 0); }

public void setSrc(final String uriString, final String type, final boolean isNetwork, final boolean isAsset, /*final ReadableMap requestHeaders,*/ final int expansionMainVersion, final int expansionPatchVersion) {

    mSrcUriString = uriString;
    mSrcType = type;
    mSrcIsNetwork = isNetwork;
    mSrcIsAsset = isAsset;
    //mRequestHeaders = requestHeaders;
    mMainVer = expansionMainVersion;
    mPatchVer = expansionPatchVersion;

.....

           /* if (mRequestHeaders != null) {
                headers.putAll(toStringMap(mRequestHeaders));
            }*/

.....

   // WritableMap wRequestHeaders = Arguments.createMap();
   // wRequestHeaders.merge(mRequestHeaders);

    src.putString(ReactVideoViewManager.PROP_SRC_URI, uriString);
    src.putString(ReactVideoViewManager.PROP_SRC_TYPE, type);
    //src.putMap(ReactVideoViewManager.PROP_SRC_HEADERS, wRequestHeaders);

.... @override protected void onAttachedToWindow() { super.onAttachedToWindow();

    if(mMainVer>0) {
        setSrc(mSrcUriString, mSrcType, mSrcIsNetwork, mSrcIsAsset, /*mRequestHeaders ,*/ mMainVer, mPatchVer);
    }
    else {
        setSrc(mSrcUriString, mSrcType, mSrcIsNetwork, mSrcIsAsset /*,mRequestHeaders*/);
    }
    setKeepScreenOn(true);
}

..... `

and in ReactVideoViewManager.java : ... //public static final String PROP_SRC_HEADERS = "requestHeaders"; .... //src.getMap(PROP_SRC_HEADERS), ....

After wasting so many hours, finally found the solution...Thanks a ton

shyamalVixplor avatar Nov 20 '20 20:11 shyamalVixplor