You.i Engine
YiAbstractVideoPlayer.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_ABSTRACT_VIDEO_PLAYER_H_
3 #define _YI_ABSTRACT_VIDEO_PLAYER_H_
4 
5 #include "network/YiHTTPHeader.h"
6 #include "network/YiUrl.h"
7 #include "signal/YiSignal.h"
8 #include "utility/YiRtti.h"
9 #include "utility/YiTime.h"
10 #include "utility/YiTimer.h"
11 
12 #include <glm/fwd.hpp>
13 
14 #include <limits>
15 
16 class CYIAssetTexture;
17 class CYIAssetVideo;
19 class CYIColor;
20 class CYIMaterial;
22 class CYIVideoSurface;
23 
57 {
59 
60 public:
61  using RTTIInstantiatability = CYIRuntimeTypeInfo::NonInstantiableTag;
62 
69  enum class MediaState
70  {
71  Unloaded,
72  Preparing,
73  Ready
74  };
75 
82  enum class PlaybackState
83  {
84  Playing,
85  Paused,
86  Buffering
87  };
88 
92  struct PlayerState
93  {
96  };
97 
103  enum class StreamingFormat
104  {
105  HLS = 0,
106  Smooth,
107  DASH,
108  MP4
109  };
110 
116  enum class DRMScheme
117  {
118  None = 0,
119  FairPlay,
120  PlayReady,
121  WidevineModular,
122  WidevineModularCustomRequest
123  };
124 
133  {
134  public:
135  virtual ~DRMConfiguration() = default;
136 
140  virtual DRMScheme GetScheme() const = 0;
141  };
142 
148  enum class ErrorCode
149  {
150  PlaybackError,
151  UnsupportedFormat,
152  StateTransitionError,
153  DRMError,
154  InitializationError,
156  Unknown
157  };
158 
162  struct Error
163  {
165  : errorCode(ErrorCode::Unknown)
166  {
167  }
168 
172  };
173 
177  struct TrackInfo
178  {
179  uint32_t id;
183  TrackInfo(uint32_t id)
184  : id(id)
185  {
186  }
187  TrackInfo(uint32_t id, const CYIString &name)
188  : id(id)
189  , name(name)
190  {
191  }
192  TrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
193  : id(id)
194  , name(name)
195  , language(language)
196  {
197  }
198  };
199 
203  struct AudioTrackInfo : public TrackInfo
204  {
205  static uint32_t DEFAULT_TRACK_ID;
207  : TrackInfo(DEFAULT_TRACK_ID)
208  , isValid(false)
209  {
210  }
211  AudioTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
212  : TrackInfo(id, name, language)
213  , isValid(true)
214  {
215  }
216  AudioTrackInfo(const TrackInfo &trackInfo)
217  : TrackInfo(trackInfo)
218  , isValid(true)
219  {
220  }
221  bool isValid;
222  };
223 
228  {
229  static uint32_t OFF_TRACK_ID;
231  : TrackInfo(OFF_TRACK_ID)
232  {
233  }
234  ClosedCaptionsTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
235  : TrackInfo(id, name, language)
236  {
237  }
239  : TrackInfo(trackInfo)
240  {
241  }
242  };
243 
250  {
251  public:
252  virtual ~BackgroundPlaybackInterface() = default;
253 
257  virtual bool IsBackgroundPlaybackEnabled() const = 0;
258 
262  virtual void EnableBackgroundPlayback(bool enabled) = 0;
263 
268  virtual void SetMetadata(const CYIString &title, const CYIString &text, const CYIUrl &imageUri) = 0;
269 
273  virtual void SetRewindIncrementMs(std::chrono::milliseconds increment) = 0;
277  virtual void SetFastForwardIncrementMs(std::chrono::milliseconds increment) = 0;
278 
282  virtual void SetNotificationColor(const CYIColor &color) = 0;
283  };
284 
291  {
292  public:
293  virtual ~HeadphoneJackInterface() = default;
294 
298  virtual void EnablePauseOnHeadphonesUnplugged(bool enabled) = 0;
299 
303  virtual bool IsPausingOnHeadphonesUnplugged() const = 0;
304  };
305 
314  {
315  public:
316  virtual ~VideoRequestHTTPHeadersInterface() = default;
317 
321  virtual std::vector<CYIHTTPHeader> SetHeaders(const std::vector<CYIHTTPHeader> &customHeaders) = 0;
322 
326  virtual bool AddHeader(const CYIHTTPHeader &header) = 0;
327 
331  virtual bool RemoveHeader(const CYIString &name) = 0;
332 
336  virtual void ClearHeaders() = 0;
337 
341  virtual std::vector<CYIHTTPHeader> GetHeaders() const = 0;
342  };
343 
348  {
352  std::chrono::milliseconds min;
353 
357  std::chrono::milliseconds max;
358 
359  BufferLength(std::chrono::milliseconds minIn, std::chrono::milliseconds maxIn)
360  : min(minIn)
361  , max(maxIn)
362  {
363  }
364 
369  : min(0)
370  , max(0)
371  {
372  }
373  };
374 
385  {
386  public:
387  virtual ~BufferingInterface() = default;
388 
392  virtual void SetBufferLength(const BufferLength &bufferLength) = 0;
393 
397  virtual BufferLength GetBufferLength() const = 0;
398  };
399 
406  {
407  // ID3 Related Keys
412 
413  // DASH Event Message Related Keys
443  static const CYIString EventMessageId;
448  };
449 
454  {
458  TimedMetadata();
459 
462  std::chrono::microseconds timestamp;
463  std::chrono::microseconds duration;
464  std::map<CYIString, CYIString> additionalData;
465  };
466 
473  {
474  public:
475  virtual ~TimedMetadataInterface() = default;
476 
483  };
484 
491  {
492  public:
500  {
501  public:
502  virtual ~ControlsHandler() = default;
503 
507  virtual void OnPlay(CYIAbstractVideoPlayer *pPlayer);
508 
512  virtual void OnPause(CYIAbstractVideoPlayer *pPlayer);
513 
517  virtual void OnSeek(CYIAbstractVideoPlayer *pPlayer, uint64_t positionMs);
518 
522  virtual void OnStop(CYIAbstractVideoPlayer *pPlayer);
523 
527  virtual void OnClosedCaptionsEnabled(CYIAbstractVideoPlayer *pPlayer, bool enabled);
528  };
529 
530  virtual ~MediaPlaybackControlsInterface() = default;
531 
539  virtual void EnableMediaPlaybackControl(bool enabled) = 0;
540 
544  virtual bool IsMediaPlaybackControlEnabled() const = 0;
545 
551  virtual void SetControlsHandler(ControlsHandler *pControlsHandler) = 0;
552  };
553 
554  virtual ~CYIAbstractVideoPlayer();
555 
559  CYIString GetName() const;
560 
567  CYIString GetVersion() const;
568 
574  struct Statistics
575  {
581  Statistics();
582 
583  bool operator==(const Statistics &other) const;
584  bool operator!=(const Statistics &other) const;
585 
589  bool isLive;
590 
597 
604 
611 
618 
625 
632 
639 
646 
653 
660  };
661 
665  Statistics GetStatistics() const;
666 
672  void Init();
673 
687  void Prepare(const CYIUrl &videoURI, StreamingFormat formatHint, CYIAbstractVideoPlayer::PlaybackState initialState = CYIAbstractVideoPlayer::PlaybackState::Paused, std::unique_ptr<DRMConfiguration> pDRMConfiguration = nullptr, uint64_t startTimeMs = 0);
688 
694  void Prepare(const std::shared_ptr<CYIAssetVideo> &videoAsset, StreamingFormat formatHint, CYIAbstractVideoPlayer::PlaybackState initialState = CYIAbstractVideoPlayer::PlaybackState::Paused, std::unique_ptr<DRMConfiguration> pDRMConfiguration = nullptr, uint64_t startTimeMs = 0);
695 
701  void Play();
702 
708  void Pause();
709 
713  void Stop();
714 
722  {
726  SeekableRange(uint64_t startTimeMs, uint64_t endTimeMs)
727  : startTimeMs(startTimeMs)
728  , endTimeMs(endTimeMs)
729  {
730  }
731 
735  uint64_t startTimeMs;
736 
740  uint64_t endTimeMs;
741  };
742 
750  std::vector<SeekableRange> GetLiveSeekableRanges() const;
751 
757  void Seek(uint64_t seekPositionMs);
758 
762  bool SupportsFormat(StreamingFormat streamingFormat, DRMScheme drmScheme = DRMScheme::None);
763 
767  uint64_t GetDurationMs() const;
768 
772  uint64_t GetCurrentTimeMs() const;
773 
780 
786  void SetClosedCaptionsEnabled(bool enabled);
787 
796 
809  bool SelectClosedCaptionsTrack(uint32_t id);
810 
821  std::vector<ClosedCaptionsTrackInfo> GetClosedCaptionsTracks() const;
822 
831 
832  /*
833  \details Returns the closed captions dispatcher for the player.
834 
835  This will return null if the player implementation does not provide control over closed captions rendering.
836  */
838 
842  CYIVideoSurface *GetSurface() const;
843 
849  bool AreAudioTracksAvailable() const;
850 
860  bool SelectAudioTrack(uint32_t id);
861 
872  std::vector<AudioTrackInfo> GetAudioTracks() const;
873 
882 
886  bool IsMuted() const;
887 
891  void Mute(bool mute);
892 
902  void SetMaxBitrate(uint64_t maxBitrate);
903 
911  void SetInitialBandwidthHint(uint64_t initialBandwidthHint);
912 
924  void SetUserAgent(const CYIString &userAgent);
925 
933  const DRMConfiguration *GetDRMConfiguration() const;
934 
943 
948 
953 
958 
963 
968 
973 
977  using RefreshDRMConfigurationCallback = std::function<std::unique_ptr<CYIAbstractVideoPlayer::DRMConfiguration>(std::unique_ptr<CYIAbstractVideoPlayer::DRMConfiguration>)>;
979 
986 
993 
1000 
1005 
1010 
1015 
1020 
1026 
1032 
1038 
1044 
1049 
1054 
1059 
1064 
1069 
1074 
1079 
1080 protected:
1082 
1086  const std::shared_ptr<CYIMaterial> &GetVideoMaterial() const;
1087 
1091  void SetVideoSurfaceSize(const glm::ivec2 &size);
1092 
1097 
1102 
1107 
1111  void UpdateCurrentTime();
1112 
1117 
1123 
1129 
1135 
1142 
1148  std::unique_ptr<CYIVideoPlayerStateManager> m_pStateManager;
1149 
1156  std::unique_ptr<CYIClosedCaptionsDispatcher> m_pClosedCaptionsDispatcher;
1157 
1164  std::unique_ptr<DRMConfiguration> m_pDRMConfiguration;
1165 
1169  uint64_t m_maxBitrate;
1170 
1175 
1182 
1187 
1188 private:
1189  struct SeekState
1190  {
1191  enum class Direction
1192  {
1193  Forward,
1194  Reverse
1195  };
1196 
1197  bool active;
1198  Direction direction;
1199  uint64_t requestedPositionMs;
1200  uint64_t positionBeforeSeekMs;
1201  };
1202 
1203  class TimeUpdater : public CYITime::UpdateListener
1204  {
1205  public:
1206  TimeUpdater();
1207  void SetPlayer(CYIAbstractVideoPlayer *pPlayer);
1208  virtual bool OnFrameTimeUpdated(std::chrono::microseconds frameTime) override;
1209 
1210  private:
1211  CYIAbstractVideoPlayer *m_pPlayer;
1212  uint64_t m_lastUpdateUs;
1213  };
1214  friend class TimeUpdater;
1215 
1216 #if defined(DOXY)
1217  // We want to document this private section because users override these methods called by the abstract player.
1218 protected:
1219 #endif
1220 
1224  virtual CYIString GetName_() const;
1225 
1231  virtual CYIString GetVersion_() const;
1232 
1236  virtual Statistics GetStatistics_() const;
1237 
1238  /*
1239  \details Subclasses can extend this function to do additional work outside of the constructor for initializing the player.
1240 
1241  \sa #Init
1242  */
1243  virtual void Init_();
1244 
1245  /*
1246  \details Subclasses must implement this function to create the correct CYIVideoSurface instance for the CYIAbstractVideoPlayer implementation.
1247 
1248  \note The surface will be stored in m_pVideoSurface and will be cleaned up automatically.
1249  */
1250  virtual std::unique_ptr<CYIVideoSurface> CreateSurface_() = 0;
1251 
1257  virtual bool SupportsFormat_(StreamingFormat streamingFormat, DRMScheme drmScheme = DRMScheme::None) const = 0;
1258 
1264  virtual bool HasNativeStartTimeHandling_() const;
1265 
1271  virtual bool HasNativeBitrateEventHandling_() const;
1272 
1281  virtual bool HasNativeSeekEventHandling_() const;
1282 
1290  virtual bool HasInitialBandwidthHintHandling_() const;
1291 
1313  virtual void Prepare_(const CYIUrl &videoURI, StreamingFormat format) = 0;
1314 
1324  virtual void Play_() = 0;
1325 
1335  virtual void Pause_() = 0;
1336 
1342  virtual void Stop_() = 0;
1343 
1349  virtual uint64_t GetDurationMs_() const = 0;
1350 
1356  virtual uint64_t GetCurrentTimeMs_() const = 0;
1357 
1363  virtual std::vector<SeekableRange> GetLiveSeekableRanges_() const = 0;
1364 
1370  virtual void Seek_(uint64_t seekPositionMS) = 0;
1371 
1380  virtual bool SelectAudioTrack_(uint32_t id) = 0;
1381 
1389  virtual std::vector<AudioTrackInfo> GetAudioTracks_() const = 0;
1390 
1400 
1406  virtual bool IsMuted_() const = 0;
1407 
1411  virtual void Mute_(bool mute) = 0;
1412 
1416  virtual void DisableClosedCaptions_() = 0;
1417 
1426  virtual bool SelectClosedCaptionsTrack_(uint32_t id) = 0;
1427 
1435  virtual std::vector<ClosedCaptionsTrackInfo> GetClosedCaptionsTracks_() const = 0;
1436 
1446 
1454  virtual void GetClosedCaptionsDispatcher_() const;
1455 
1459  virtual void SetMaxBitrate_(uint64_t maxBitrate);
1460 
1464  virtual void SetUserAgent_(const CYIString &userAgent);
1465 
1470 
1475 
1479  virtual BufferingInterface *GetBufferingInterface_() const;
1480 
1485 
1490 
1495 
1496 #if defined(DOXY)
1497 private:
1498 #endif
1499 
1500  void CheckAndNotifyAudioTracksChanged();
1501  void CheckAndNotifyClosedCaptionsTracksChanged();
1502  void CheckAndNotifyBitrateChanged();
1503  void OnNotifyErrorOccurred(Error error);
1504  void OnNotifyPlaybackComplete();
1505  void OnNotifyDurationChanged(uint64_t duration);
1506  void UpdateSeekState(uint64_t positionBeforeSeekMs, uint64_t requestedPositionMs);
1507  void OnNotifySeekCompleted(bool success, uint64_t positionAfterSeekMs);
1508  void ClearCachedTrackData();
1509  void OnStateReady();
1510  void OnStateUnloaded();
1511  void ClearClosedCaptions();
1512  void SetTimeUpdatesEnabled(bool enabled);
1513 
1514  bool m_audioTracksAvailable;
1515  std::vector<AudioTrackInfo> m_audioTracksCache;
1516 
1517  float m_cachedTotalBitrate;
1518  float m_cachedVideoBitrate;
1519  float m_cachedAudioBitrate;
1520 
1521  std::unique_ptr<CYIVideoSurface> m_pVideoSurface;
1522  uint64_t m_lastNotifiedTime;
1523  TimeUpdater m_timeUpdater;
1524  PlaybackState m_initialPlaybackState;
1525  PlaybackState m_requestedInitialPlaybackState;
1526  CYITimer m_mediaTracksRefreshTimer;
1527  CYITimer m_bitrateRefreshTimer;
1528  bool m_isMuted;
1529  SeekState m_seekState;
1530 
1531  bool m_closedCaptionsTracksAvailable;
1532  std::vector<ClosedCaptionsTrackInfo> m_closedCaptionsTracksCache;
1533  uint32_t m_previousClosedCaptionsTrackId;
1534  static const ClosedCaptionsTrackInfo CLOSED_CAPTIONS_OFF_TRACK;
1535 
1538 };
1539 
1544 // Audio tracks
1547 
1548 // Closed captions tracks
1549 bool operator==(const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackL, const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackR);
1550 bool operator!=(const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackL, const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackR);
1551 
1552 // Timed Metadata
1553 bool operator==(const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataL, const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataR);
1554 bool operator!=(const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataL, const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataR);
1555 
1556 //States
1557 bool operator==(const CYIAbstractVideoPlayer::PlayerState &playerStateL, const CYIAbstractVideoPlayer::PlayerState &playerStateR);
1558 bool operator==(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::MediaState &mediaState);
1559 bool operator==(const CYIAbstractVideoPlayer::MediaState &mediaState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1560 bool operator==(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::PlaybackState &playbackState);
1561 bool operator==(const CYIAbstractVideoPlayer::PlaybackState &playbackState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1562 
1563 bool operator!=(const CYIAbstractVideoPlayer::PlayerState &playerStateL, const CYIAbstractVideoPlayer::PlayerState &playerStateR);
1564 bool operator!=(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::MediaState &mediaState);
1565 bool operator!=(const CYIAbstractVideoPlayer::MediaState &mediaState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1566 bool operator!=(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::PlaybackState &playbackState);
1567 bool operator!=(const CYIAbstractVideoPlayer::PlaybackState &playbackState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1568 
1569 #endif //ifndef _YI_ABSTRACT_VIDEO_PLAYER_H_
virtual uint64_t GetDurationMs_() const =0
TrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
Definition: YiAbstractVideoPlayer.h:192
virtual void SetMaxBitrate_(uint64_t maxBitrate)
std::vector< ClosedCaptionsTrackInfo > GetClosedCaptionsTracks() const
static const CYIString ID3PrivateFrameOwner
Definition: YiAbstractVideoPlayer.h:411
virtual void SetUserAgent_(const CYIString &userAgent)
CYISignal PlaybackComplete
Definition: YiAbstractVideoPlayer.h:1025
bool AreClosedCaptionsTracksAvailable() const
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:122
BackgroundPlaybackInterface * GetBackgroundPlaybackInterface() const
CYIRuntimeTypeInfo::NonInstantiableTag RTTIInstantiatability
Definition: YiAbstractVideoPlayer.h:61
CYIVideoSurface * GetSurface() const
Definition: YiAbstractVideoPlayer.h:203
CYISignal< float > AudioBitrateChanged
Definition: YiAbstractVideoPlayer.h:1078
float renderedFramesPerSecond
Definition: YiAbstractVideoPlayer.h:652
Definition: YiAbstractVideoPlayer.h:384
Definition: YiAbstractVideoPlayer.h:347
std::map< CYIString, CYIString > additionalData
Definition: YiAbstractVideoPlayer.h:464
uint64_t m_initialBandwidthHint
Definition: YiAbstractVideoPlayer.h:1174
std::unique_ptr< DRMConfiguration > m_pDRMConfiguration
Definition: YiAbstractVideoPlayer.h:1164
void SetClosedCaptionsEnabled(bool enabled)
virtual bool IsMuted_() const =0
HeadphoneJackInterface * GetHeadphoneJackInterface() const
Definition: YiAbstractVideoPlayer.h:177
Statistics GetStatistics() const
void ChangeInitialPlaybackState(CYIAbstractVideoPlayer::PlaybackState initialState)
virtual VideoRequestHTTPHeadersInterface * GetVideoRequestHTTPHeadersInterface_()
virtual std::vector< SeekableRange > GetLiveSeekableRanges_() const =0
ClosedCaptionsTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
Definition: YiAbstractVideoPlayer.h:234
CYISignal< std::vector< ClosedCaptionsTrackInfo > > AvailableClosedCaptionsTracksChanged
Definition: YiAbstractVideoPlayer.h:1063
BufferingInterface * GetBufferingInterface() const
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
CYISignal BufferingEnded
Definition: YiAbstractVideoPlayer.h:992
float bufferLengthMs
Definition: YiAbstractVideoPlayer.h:638
CYISignal< Error > ErrorOccurred
Definition: YiAbstractVideoPlayer.h:999
bool SupportsFormat(StreamingFormat streamingFormat, DRMScheme drmScheme=DRMScheme::None)
AudioTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
Definition: YiAbstractVideoPlayer.h:211
virtual std::unique_ptr< CYIVideoSurface > CreateSurface_()=0
A texture asset representing an image which will be loaded into the GPU.
Definition: YiAssetTexture.h:22
std::function< std::unique_ptr< CYIAbstractVideoPlayer::DRMConfiguration >(std::unique_ptr< CYIAbstractVideoPlayer::DRMConfiguration >)> RefreshDRMConfigurationCallback
Definition: YiAbstractVideoPlayer.h:977
static const CYIString EventMessagePTSDelta
Definition: YiAbstractVideoPlayer.h:433
CYISignal Preparing
Definition: YiAbstractVideoPlayer.h:1004
CYISignal< const CYIAbstractVideoPlayer::PlayerState & > PlayerStateChanged
Definition: YiAbstractVideoPlayer.h:1053
bool operator!=(const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackL, const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackR)
uint64_t startTimeMs
Definition: YiAbstractVideoPlayer.h:735
Definition: YiAbstractVideoPlayer.h:313
ClosedCaptionsTrackInfo()
Definition: YiAbstractVideoPlayer.h:230
CYIString value
Definition: YiAbstractVideoPlayer.h:461
const std::shared_ptr< CYIMaterial > & GetVideoMaterial() const
static const CYIString EventMessageValue
Definition: YiAbstractVideoPlayer.h:423
TrackInfo(uint32_t id)
Definition: YiAbstractVideoPlayer.h:183
CYIMaterial is a place holder for all the drawing parameters required by the renderer to draw a mesh/...
Definition: YiMaterial.h:26
ClosedCaptionsTrackInfo(const TrackInfo &trackInfo)
Definition: YiAbstractVideoPlayer.h:238
CYISignal Finalized
Definition: YiAbstractVideoPlayer.h:1031
bool SelectClosedCaptionsTrack(uint32_t id)
CYISignal Ready
Definition: YiAbstractVideoPlayer.h:1009
static const CYIString EventMessageMessageData
Definition: YiAbstractVideoPlayer.h:447
virtual CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo GetActiveClosedCaptionsTrack_() const =0
std::chrono::milliseconds min
Definition: YiAbstractVideoPlayer.h:352
virtual bool SelectClosedCaptionsTrack_(uint32_t id)=0
AudioTrackInfo(const TrackInfo &trackInfo)
Definition: YiAbstractVideoPlayer.h:216
float defaultAudioBitrateKbps
Definition: YiAbstractVideoPlayer.h:631
TrackInfo(uint32_t id, const CYIString &name)
Definition: YiAbstractVideoPlayer.h:187
Definition: YiAbstractVideoPlayer.h:290
CYISignal< float > TotalBitrateChanged
Definition: YiAbstractVideoPlayer.h:1068
virtual BufferingInterface * GetBufferingInterface_() const
CYISignal< bool, uint64_t > NotifySeekCompleted
Definition: YiAbstractVideoPlayer.h:1141
static const CYIString EventMessageDuration
Definition: YiAbstractVideoPlayer.h:439
static uint32_t DEFAULT_TRACK_ID
Definition: YiAbstractVideoPlayer.h:205
MediaState mediaState
Definition: YiAbstractVideoPlayer.h:94
void SetRefreshDRMConfigurationCallback(RefreshDRMConfigurationCallback callback)
A class which manages the various media and playback states of the CYIAbstractVideoPlayer.
Definition: YiVideoPlayerStateManager.h:44
AudioTrackInfo GetActiveAudioTrack() const
constexpr std::enable_if< YiEnableBitmaskOperators< E >::enable, bool >::type None(E a)
Definition: YiEnumBitmaskOperators.h:136
CYISignal< float > VideoBitrateChanged
Definition: YiAbstractVideoPlayer.h:1073
virtual ~CYIAbstractVideoPlayer()
CYISignal BufferingStarted
Definition: YiAbstractVideoPlayer.h:985
Definition: YiAbstractVideoPlayer.h:405
virtual void Stop_()=0
virtual CYIString GetVersion_() const
uint64_t GetCurrentTimeMs() const
A class respresenting an HTTP Header Field with a field-name and field-value as specified in https://...
Definition: YiHTTPHeader.h:17
virtual bool HasInitialBandwidthHintHandling_() const
An abstract video player that provides a basic interface that all subclasses must implement...
Definition: YiAbstractVideoPlayer.h:56
CYISignal< uint64_t > CurrentTimeUpdated
Definition: YiAbstractVideoPlayer.h:1037
ErrorCode errorCode
Definition: YiAbstractVideoPlayer.h:169
Definition: YiAbstractVideoPlayer.h:92
CYISignal Paused
Definition: YiAbstractVideoPlayer.h:1019
bool isValid
Definition: YiAbstractVideoPlayer.h:221
virtual Statistics GetStatistics_() const
uint64_t endTimeMs
Definition: YiAbstractVideoPlayer.h:740
static const CYIString EventMessageSchemeId
Definition: YiAbstractVideoPlayer.h:417
RefreshDRMConfigurationCallback m_refreshDRMConfigurationCallback
Definition: YiAbstractVideoPlayer.h:1186
Definition: YiAbstractVideoPlayer.h:453
CYIAbstractVideoPlayer::PlaybackState GetRequestedInitialPlaybackState() const
Definition: YiAbstractVideoPlayer.h:162
Definition: YiTime.h:28
virtual bool HasNativeBitrateEventHandling_() const
uint32_t id
Definition: YiAbstractVideoPlayer.h:179
A low-precision timer driven by the update loop.
Definition: YiTimer.h:27
virtual BackgroundPlaybackInterface * GetBackgroundPlaybackInterface_() const
bool AreAudioTracksAvailable() const
virtual bool SelectAudioTrack_(uint32_t id)=0
virtual TimedMetadataInterface * GetTimedMetadataInterface_() const
float minimumBufferLengthMs
Definition: YiAbstractVideoPlayer.h:645
CYISignal NotifyPlaybackComplete
Definition: YiAbstractVideoPlayer.h:1128
virtual void Pause_()=0
PlaybackState
Definition: YiAbstractVideoPlayer.h:82
virtual std::vector< AudioTrackInfo > GetAudioTracks_() const =0
CYIString nativePlayerErrorCode
Definition: YiAbstractVideoPlayer.h:171
uint64_t m_initialStartTimeMs
Definition: YiAbstractVideoPlayer.h:1181
void Mute(bool mute)
CYISignal< uint64_t > DurationChanged
Definition: YiAbstractVideoPlayer.h:1043
virtual void Seek_(uint64_t seekPositionMS)=0
float totalBitrateKbps
Definition: YiAbstractVideoPlayer.h:596
bool SelectAudioTrack(uint32_t id)
SeekableRange(uint64_t startTimeMs, uint64_t endTimeMs)
Definition: YiAbstractVideoPlayer.h:726
PlaybackState playbackState
Definition: YiAbstractVideoPlayer.h:95
CYIAbstractVideoPlayer::PlayerState GetPlayerState() const
bool isLive
Definition: YiAbstractVideoPlayer.h:589
The base class for all DRM configurations.
Definition: YiAbstractVideoPlayer.h:132
float defaultTotalBitrateKbps
Definition: YiAbstractVideoPlayer.h:617
std::chrono::milliseconds max
Definition: YiAbstractVideoPlayer.h:357
Definition: YiAbstractVideoPlayer.h:249
uint64_t m_maxBitrate
Definition: YiAbstractVideoPlayer.h:1169
CYIClosedCaptionsDispatcher * GetClosedCaptionsDispatcher() const
A class used to encapsulate an URL.
Definition: YiUrl.h:24
virtual void DisableClosedCaptions_()=0
virtual void GetClosedCaptionsDispatcher_() const
std::chrono::microseconds timestamp
Definition: YiAbstractVideoPlayer.h:462
CYISignal Playing
Definition: YiAbstractVideoPlayer.h:1014
std::unique_ptr< CYIVideoPlayerStateManager > m_pStateManager
Definition: YiAbstractVideoPlayer.h:1148
float audioBitrateKbps
Definition: YiAbstractVideoPlayer.h:610
Definition: YiSignalHandler.h:175
static uint32_t OFF_TRACK_ID
Definition: YiAbstractVideoPlayer.h:229
CYIString message
Definition: YiAbstractVideoPlayer.h:170
std::vector< AudioTrackInfo > GetAudioTracks() const
CYISignal< bool, uint64_t > SeekCompleted
Definition: YiAbstractVideoPlayer.h:1048
bool operator==(const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackL, const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackR)
void SetUserAgent(const CYIString &userAgent)
CYIString GetName() const
CYIString name
Definition: YiAbstractVideoPlayer.h:180
ErrorCode
Definition: YiAbstractVideoPlayer.h:148
Definition: YiAbstractVideoPlayer.h:472
static const CYIString EventMessageTimescale
Definition: YiAbstractVideoPlayer.h:427
StreamingFormat
Definition: YiAbstractVideoPlayer.h:103
Dispatches closed captioning cues to registered captions renderers.
Definition: YiClosedCaptionsDispatcher.h:27
virtual CYIAbstractVideoPlayer::AudioTrackInfo GetActiveAudioTrack_() const =0
BufferLength(std::chrono::milliseconds minIn, std::chrono::milliseconds maxIn)
Definition: YiAbstractVideoPlayer.h:359
Definition: YiAbstractVideoPlayer.h:574
friend class TimeUpdater
Definition: YiAbstractVideoPlayer.h:1214
void CheckAndNotifyMediaTracksChanged()
MediaState
Definition: YiAbstractVideoPlayer.h:69
void Prepare(const CYIUrl &videoURI, StreamingFormat formatHint, CYIAbstractVideoPlayer::PlaybackState initialState=CYIAbstractVideoPlayer::PlaybackState::Paused, std::unique_ptr< DRMConfiguration > pDRMConfiguration=nullptr, uint64_t startTimeMs=0)
BufferLength()
Definition: YiAbstractVideoPlayer.h:368
void SetMaxBitrate(uint64_t maxBitrate)
const DRMConfiguration * GetDRMConfiguration() const
std::unique_ptr< CYIClosedCaptionsDispatcher > m_pClosedCaptionsDispatcher
Definition: YiAbstractVideoPlayer.h:1156
uint64_t GetDurationMs() const
void SetInitialBandwidthHint(uint64_t initialBandwidthHint)
static const CYIString EventMessageId
Definition: YiAbstractVideoPlayer.h:443
CYISignal< uint64_t > NotifyDurationChanged
Definition: YiAbstractVideoPlayer.h:1134
TimedMetadataInterface * GetTimedMetadataInterface() const
void SetVideoSurfaceSize(const glm::ivec2 &size)
void Seek(uint64_t seekPositionMs)
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
float videoBitrateKbps
Definition: YiAbstractVideoPlayer.h:603
Definition: YiAbstractVideoPlayer.h:490
float encodedFramesPerSecond
Definition: YiAbstractVideoPlayer.h:659
float defaultVideoBitrateKbps
Definition: YiAbstractVideoPlayer.h:624
CYISignal< std::vector< AudioTrackInfo > > AvailableAudioTracksChanged
Definition: YiAbstractVideoPlayer.h:1058
virtual CYIString GetName_() const
AudioTrackInfo()
Definition: YiAbstractVideoPlayer.h:206
virtual void Init_()
CYIString identifier
Definition: YiAbstractVideoPlayer.h:460
std::chrono::microseconds duration
Definition: YiAbstractVideoPlayer.h:463
virtual void Prepare_(const CYIUrl &videoURI, StreamingFormat format)=0
This file contains the classes and macros used to implement RTTI in You.i Engine. ...
A class used to represent a color value.
Definition: YiColor.h:31
CYISignal< TimedMetadata > MetadataAvailable
Definition: YiAbstractVideoPlayer.h:482
ClosedCaptionsTrackInfo GetActiveClosedCaptionsTrack() const
CYIString language
Definition: YiAbstractVideoPlayer.h:181
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:168
std::vector< SeekableRange > GetLiveSeekableRanges() const
virtual void Mute_(bool mute)=0
Asset representing a video.
Definition: YiAssetVideo.h:20
virtual MediaPlaybackControlsInterface * GetMediaPlaybackControlsInterface_() const
DRMScheme
Definition: YiAbstractVideoPlayer.h:116
virtual bool HasNativeStartTimeHandling_() const
virtual bool HasNativeSeekEventHandling_() const
virtual std::vector< ClosedCaptionsTrackInfo > GetClosedCaptionsTracks_() const =0
CYISignal< Error > NotifyErrorOccurred
Definition: YiAbstractVideoPlayer.h:1122
Representation of a CYIAbstractVideoPlayer&#39;s video surface.
Definition: YiVideoSurface.h:34
virtual void Play_()=0
MediaPlaybackControlsInterface * GetMediaPlaybackControlsInterface() const
CYIString GetVersion() const
Definition: YiAbstractVideoPlayer.h:227
virtual HeadphoneJackInterface * GetHeadphoneJackInterface_() const
Error()
Definition: YiAbstractVideoPlayer.h:164
virtual uint64_t GetCurrentTimeMs_() const =0
Definition: YiAbstractVideoPlayer.h:721
virtual bool SupportsFormat_(StreamingFormat streamingFormat, DRMScheme drmScheme=DRMScheme::None) const =0
VideoRequestHTTPHeadersInterface * GetVideoRequestHTTPHeadersInterface()