21#include <config_features.h>
24#include <com/sun/star/lang/NoSupportException.hpp>
25#include <com/sun/star/lang/XComponent.hpp>
44 const OUString& rSoundURL,
48 std::shared_ptr<SoundPlayer> pPlayer(
54 pPlayer->mThis = pPlayer;
77 xComponent->dispose();
84 const OUString& rSoundURL,
92 "SoundPlayer::SoundPlayer(): Invalid component context" );
94#if !HAVE_FEATURE_AVMEDIA
95 (void) rMediaFileManager;
99 if (rSoundURL.startsWithIgnoreAsciiCase(
"vnd.sun.star.Package:"))
107 catch( uno::RuntimeException& )
111 catch( uno::Exception& )
117 throw lang::NoSupportException(
118 "No sound support for " + rSoundURL );
127 catch (uno::Exception &) {
137 const double nDuration(
mxPlayer->getDuration() );
139 return ::std::max( 0.0,
140 nDuration -
mxPlayer->getMediaTime() );
This class multiplexes user-activated and slide-show global events.
void removePauseHandler(const PauseEventHandlerSharedPtr &rHandler)
void addPauseHandler(const PauseEventHandlerSharedPtr &rHandler)
Register a handler that is called when the show enters or exits pause mode.
void setPlaybackLoop(bool bLoop)
css::uno::Reference< css::media::XPlayer > mxPlayer
virtual void dispose() override
Dispose all object references.
virtual bool handlePause(bool bPauseShow) override
Handle the event.
::std::shared_ptr< SoundPlayer > mThis
virtual ~SoundPlayer() override
::std::shared_ptr<::avmedia::MediaTempFile > mpMediaTempFile
SoundPlayer(EventMultiplexer &rEventMultiplexer, const OUString &rSoundURL, const css::uno::Reference< css::uno::XComponentContext > &rComponentContext, MediaFileManager &rMediaFileManager)
EventMultiplexer & mrEventMultiplexer
double getDuration() const
Query duration of sound playback.
static ::std::shared_ptr< SoundPlayer > create(EventMultiplexer &rEventMultiplexer, const OUString &rSoundURL, const css::uno::Reference< css::uno::XComponentContext > &rComponentContext, MediaFileManager &rMediaFileManager)
Create a sound player object.
#define TOOLS_WARN_EXCEPTION(area, stream)
#define ENSURE_OR_THROW(c, m)
EventMultiplexer & mrEventMultiplexer