TheWidlarzGroup/react-native-video

[Bug]: Crash When Source is set to null

Open

#3,188 opened on Jul 30, 2023

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Kotlin (3,027 forks)batch import
6.x.xMissing ReproNewer Version AvailablePlatform: WindowsV6bugdifficulty: easygood first issuehelp wantedpriority: lowtriaged

Repository metrics

Stars
 (7,677 stars)
PR merge metrics
 (Avg merge 2d 3h) (11 merged PRs in 30d)

Description

What happened?

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

According to the documentation, providing a null source value after loading a previous source should stop playback and clear out the previous source content. Instead, the Video component crashes.

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]	

Expected behaviour:

The Video component should clear the previous source and stop playback, rather than crash.

Reproducible sample code:

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

Steps to reproduce

  1. Set the source prop to a local/hosted video.
  2. Change the source prop to null.
  3. Observe the app crashing on Windows.

Reproduction repository

No response

react-native-video version

6.0.0-alpha.6

react-native version

0.72.3

react-native-nitro-modules version

No response

Platforms

Windows

OS version

Windows 10

Device

Real device

Architecture

No response

Expo

No response

Last working version

No response

Media / source type

No response

Contributor guide