WebPlaybackSessionModelMediaElement.h [plain text]
#ifndef WebPlaybackSessionModelMediaElement_h
#define WebPlaybackSessionModelMediaElement_h
#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
#include "EventListener.h"
#include "HTMLMediaElementEnums.h"
#include "WebPlaybackSessionModel.h"
#include <wtf/HashSet.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
class AudioTrack;
class HTMLMediaElement;
class TextTrack;
class WebPlaybackSessionInterface;
class WebPlaybackSessionModelMediaElement final : public WebPlaybackSessionModel, public EventListener {
public:
static Ref<WebPlaybackSessionModelMediaElement> create()
{
return adoptRef(*new WebPlaybackSessionModelMediaElement());
}
WEBCORE_EXPORT virtual ~WebPlaybackSessionModelMediaElement();
WEBCORE_EXPORT void setMediaElement(HTMLMediaElement*);
HTMLMediaElement* mediaElement() const { return m_mediaElement.get(); }
WEBCORE_EXPORT void handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) final;
void updateForEventName(const WTF::AtomicString&);
bool operator==(const EventListener& rhs) const final { return static_cast<const WebCore::EventListener*>(this) == &rhs; }
WEBCORE_EXPORT void addClient(WebPlaybackSessionModelClient&);
WEBCORE_EXPORT void removeClient(WebPlaybackSessionModelClient&);
WEBCORE_EXPORT void play() final;
WEBCORE_EXPORT void pause() final;
WEBCORE_EXPORT void togglePlayState() final;
WEBCORE_EXPORT void beginScrubbing() final;
WEBCORE_EXPORT void endScrubbing() final;
WEBCORE_EXPORT void seekToTime(double time) final;
WEBCORE_EXPORT void fastSeek(double time) final;
WEBCORE_EXPORT void beginScanningForward() final;
WEBCORE_EXPORT void beginScanningBackward() final;
WEBCORE_EXPORT void endScanning() final;
WEBCORE_EXPORT void selectAudioMediaOption(uint64_t index) final;
WEBCORE_EXPORT void selectLegibleMediaOption(uint64_t index) final;
double duration() const final;
double currentTime() const final;
double bufferedTime() const final;
bool isPlaying() const final;
bool isScrubbing() const final { return false; }
float playbackRate() const final;
Ref<TimeRanges> seekableRanges() const final;
bool canPlayFastReverse() const final;
Vector<WTF::String> audioMediaSelectionOptions() const final;
uint64_t audioMediaSelectedIndex() const final;
Vector<WTF::String> legibleMediaSelectionOptions() const final;
uint64_t legibleMediaSelectedIndex() const final;
bool externalPlaybackEnabled() const final;
ExternalPlaybackTargetType externalPlaybackTargetType() const final;
String externalPlaybackLocalizedDeviceName() const final;
bool wirelessVideoPlaybackDisabled() const final;
protected:
WEBCORE_EXPORT WebPlaybackSessionModelMediaElement();
private:
static const Vector<WTF::AtomicString>& observedEventNames();
const WTF::AtomicString& eventNameAll();
RefPtr<HTMLMediaElement> m_mediaElement;
bool m_isListening { false };
HashSet<WebPlaybackSessionModelClient*> m_clients;
Vector<RefPtr<TextTrack>> m_legibleTracksForMenu;
Vector<RefPtr<AudioTrack>> m_audioTracksForMenu;
double playbackStartedTime() const;
void updateLegibleOptions();
};
}
#endif
#endif