diff --git a/client/media/CVideoHandler.cpp b/client/media/CVideoHandler.cpp index 9428c7428..b13c2dfc0 100644 --- a/client/media/CVideoHandler.cpp +++ b/client/media/CVideoHandler.cpp @@ -608,9 +608,8 @@ std::pair, si64> CAudioInstance::extractAudio(const Vide bool CVideoPlayer::openAndPlayVideoImpl(const VideoPath & name, const Point & position, bool useOverlay, bool stopOnKey) { CVideoInstance instance; - CAudioInstance audio; - auto extractedAudio = audio.extractAudio(name); + auto extractedAudio = getAudio(name); int audioHandle = CCS->soundh->playSound(extractedAudio); if (!instance.openInput(name)) @@ -684,6 +683,15 @@ std::unique_ptr CVideoPlayer::open(const VideoPath & name, float std::pair, si64> CVideoPlayer::getAudio(const VideoPath & videoToOpen) { + AudioPath audioPath = videoToOpen.toType(); + AudioPath audioPathVideoDir = audioPath.addPrefix("VIDEO/"); + + if(CResourceHandler::get()->existsResource(audioPath)) + return CResourceHandler::get()->load(audioPath)->readAll(); + + if(CResourceHandler::get()->existsResource(audioPathVideoDir)) + return CResourceHandler::get()->load(audioPathVideoDir)->readAll(); + CAudioInstance audio; return audio.extractAudio(videoToOpen); }