TheWidlarzGroup / react-native-video

A <Video /> component for react-native
https://docs.thewidlarzgroup.com/react-native-video/
MIT License
7.23k stars 2.91k forks source link

Crash When Source is set to null #3188

Open fmobeireek opened 1 year ago

fmobeireek commented 1 year ago

Bug

The app is crashing when the source prop is set to null (only on Windows). The issue persists on Debug and Release builds.

Platform

Environment info

Library version: 6.0.0-alpha.6 Device: Windows 10 PC react-native: 0.72.3 react-native-windows: 0.72.1

Steps To Reproduce

  1. Set the source prop to a local/hosted video
  2. Change the source prop to null

Expected behaviour

According to the documentation providing a null source value after loading a previous source will stop playback and clear out the previous source content.

  1. Video component should clear the previous source.

Reproducible sample code

<Video
    source={null}
    style={{width:'100%', height:'100%'}}
    resizeMode={'contain'}
    onError={onError}
  />

onError message

{"errorString":"invalid url, player will stop","errorCode":"INVALID_URL"}

callstack

    ucrtbase.dll!7597eddb() Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for ucrtbase.dll]  
    [External Code] 
>   ReactNativeVideoCPP.dll!winrt::throw_hresult(const winrt::hresult result) Line 4966 C++
    ReactNativeVideoCPP.dll!winrt::ReactNativeVideoCPP::implementation::ReactVideoViewManager::UpdateProperties(const winrt::Windows::UI::Xaml::FrameworkElement & view, const winrt::Microsoft::ReactNative::IJSValueReader & propertyMapReader) Line 97   C++
    ReactNativeVideoCPP.dll!winrt::impl::produce<winrt::ReactNativeVideoCPP::implementation::ReactVideoViewManager,winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties>::UpdateProperties(void * view, void * propertyMapReader) Line 6109  C++
    [Inline Frame] Microsoft.ReactNative.dll!winrt::impl::consume_Microsoft_ReactNative_IViewManagerWithNativeProperties<winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties>::UpdateProperties(const winrt::Windows::UI::Xaml::FrameworkElement &) Line 2242   C++
    Microsoft.ReactNative.dll!winrt::Microsoft::ReactNative::ABIViewManager::UpdateProperties(Microsoft::ReactNative::ShadowNodeBase * nodeToUpdate, winrt::Microsoft::ReactNative::JSValueObject & props) Line 128 C++
    Microsoft.ReactNative.dll!Microsoft::ReactNative::ShadowNodeBase::updateProperties(winrt::Microsoft::ReactNative::JSValueObject & props) Line 31    C++
    Microsoft.ReactNative.dll!Microsoft::ReactNative::UIManagerModule::createView(__int64 reactTag, std::string viewName, __int64 rootTag, winrt::Microsoft::ReactNative::JSValueObject && props) Line 155  C++
    Microsoft.ReactNative.dll!Microsoft::ReactNative::UIManager::createView::__l2::<lambda_1>::operator()() Line 579    C++
    Microsoft.ReactNative.dll!Mso::Details::FunctionObjectWrapper<`Microsoft::ReactNative::UIManager::createView'::`2'::<lambda_1>,void>::Invoke() Line 166 C++
    Microsoft.ReactNative.dll!Mso::ManualResetEvent::Set() Line 73  C++
    [External Code] 
    Microsoft.ReactNative.dll!Mso::React::MessageDispatchQueue::tryFunc(const std::function<void __stdcall(void)> & func) Line 126  C++
    [Inline Frame] Microsoft.ReactNative.dll!Mso::React::MessageDispatchQueue::runOnQueue::__l2::<lambda_1>::operator()() Line 34   C++
    Microsoft.ReactNative.dll!Mso::Details::FunctionObjectWrapper<`Mso::React::MessageDispatchQueue::runOnQueue'::`2'::<lambda_1>,void>::Invoke() Line 166  C++
    Microsoft.ReactNative.dll!Mso::QueueService::InvokeTask(Mso::Functor<void __stdcall(void)> && task, std::optional<std::chrono::time_point<std::chrono::steady_clock,std::chrono::duration<__int64,std::ratio<1,1000000000>>>> endTime) Line 206 C++
    Microsoft.ReactNative.dll!Mso::TaskDispatcherHandler::Invoke() Line 173 C++
    [External Code] 
fmobeireek commented 1 year ago

Solved by downgrading to 6.0.0-alpha.3.