Catch exception for not found videos

c++11
scrawl 10 years ago
parent a73362f036
commit 842ff4d874

@ -30,7 +30,18 @@ void VideoWidget::playVideo(const std::string &video)
{
mPlayer->setAudioFactory(new MWSound::MovieAudioFactory());
mPlayer->playVideo(mVFS->get(video), video);
Files::IStreamPtr videoStream;
try
{
videoStream = mVFS->get(video);
}
catch (std::exception& e)
{
std::cerr << "Failed to open video: " << e.what() << std::endl;
return;
}
mPlayer->playVideo(videoStream, video);
osg::ref_ptr<osg::Texture2D> texture = mPlayer->getVideoTexture();
if (!texture)

Loading…
Cancel
Save