You.i Engine
YiAbstractVideoPlayer.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_ABSTRACT_VIDEO_PLAYER_H_
3 #define _YI_ABSTRACT_VIDEO_PLAYER_H_
4 
5 #include "network/YiUrl.h"
6 #include "signal/YiSignal.h"
7 #include "utility/YiRtti.h"
8 #include "utility/YiTime.h"
9 #include "utility/YiTimer.h"
10 
11 #include <glm/fwd.hpp>
12 #include <glm/vec2.hpp>
13 
14 #include <limits>
15 #include <map>
16 
17 class CYIAssetVideo;
19 class CYIColor;
20 class CYIHTTPHeader;
21 class CYIMaterial;
25 class CYIVideoSurface;
26 
60 {
62 
63 public:
64  using RTTIInstantiatability = CYIRuntimeTypeInfo::NonInstantiableTag;
65 
72  enum class MediaState
73  {
74  Unloaded,
75  Preparing,
76  Ready
77  };
78 
85  enum class PlaybackState
86  {
87  Playing,
88  Paused,
89  Buffering
90  };
91 
95  struct PlayerState
96  {
99  };
100 
106  enum class StreamingFormat
107  {
108  HLS = 0,
109  Smooth,
110  DASH,
111  MP4
112  };
113 
119  enum class DRMScheme
120  {
121  None = 0,
122  FairPlay,
123  PlayReady,
124  WidevineModular,
125  WidevineModularCustomRequest
126  };
127 
136  {
137  public:
138  virtual ~DRMConfiguration() = default;
139 
143  virtual DRMScheme GetScheme() const = 0;
144  };
145 
151  enum class ErrorCode
152  {
153  PlaybackError,
154  UnsupportedFormat,
155  StateTransitionError,
156  DRMError,
157  InitializationError,
159  Unknown
160  };
161 
165  struct Error
166  {
168  : errorCode(ErrorCode::Unknown)
169  {
170  }
171 
175  };
176 
180  struct TrackInfo
181  {
182  uint32_t id;
186  TrackInfo(uint32_t id)
187  : id(id)
188  {
189  }
190  TrackInfo(uint32_t id, const CYIString &name)
191  : id(id)
192  , name(name)
193  {
194  }
195  TrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
196  : id(id)
197  , name(name)
198  , language(language)
199  {
200  }
201  };
202 
206  struct AudioTrackInfo : public TrackInfo
207  {
208  static uint32_t DEFAULT_TRACK_ID;
210  : TrackInfo(DEFAULT_TRACK_ID)
211  , isValid(false)
212  {
213  }
214  AudioTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
215  : TrackInfo(id, name, language)
216  , isValid(true)
217  {
218  }
219  AudioTrackInfo(const TrackInfo &trackInfo)
220  : TrackInfo(trackInfo)
221  , isValid(true)
222  {
223  }
224  bool isValid;
225  };
226 
231  {
232  static uint32_t OFF_TRACK_ID;
234  : TrackInfo(OFF_TRACK_ID)
235  {
236  }
237  ClosedCaptionsTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
238  : TrackInfo(id, name, language)
239  {
240  }
242  : TrackInfo(trackInfo)
243  {
244  }
245  };
246 
253  {
254  public:
255  virtual ~BackgroundPlaybackInterface() = default;
256 
260  virtual bool IsBackgroundPlaybackEnabled() const = 0;
261 
265  virtual void EnableBackgroundPlayback(bool enabled) = 0;
266 
271  virtual void SetMetadata(const CYIString &title, const CYIString &text, const CYIUrl &imageUri) = 0;
272 
276  virtual void SetRewindIncrementMs(std::chrono::milliseconds increment) = 0;
280  virtual void SetFastForwardIncrementMs(std::chrono::milliseconds increment) = 0;
281 
285  virtual void SetNotificationColor(const CYIColor &color) = 0;
286  };
287 
294  {
295  public:
296  virtual ~HeadphoneJackInterface() = default;
297 
301  virtual void EnablePauseOnHeadphonesUnplugged(bool enabled) = 0;
302 
306  virtual bool IsPausingOnHeadphonesUnplugged() const = 0;
307  };
308 
317  {
318  public:
319  virtual ~VideoRequestHTTPHeadersInterface() = default;
320 
324  virtual std::vector<CYIHTTPHeader> SetHeaders(const std::vector<CYIHTTPHeader> &customHeaders) = 0;
325 
329  virtual bool AddHeader(const CYIHTTPHeader &header) = 0;
330 
334  virtual bool RemoveHeader(const CYIString &name) = 0;
335 
339  virtual void ClearHeaders() = 0;
340 
344  virtual std::vector<CYIHTTPHeader> GetHeaders() const = 0;
345  };
346 
351  {
355  std::chrono::milliseconds min;
356 
360  std::chrono::milliseconds max;
361 
362  BufferLength(std::chrono::milliseconds minIn, std::chrono::milliseconds maxIn)
363  : min(minIn)
364  , max(maxIn)
365  {
366  }
367 
372  : min(0)
373  , max(0)
374  {
375  }
376  };
377 
388  {
389  public:
390  virtual ~BufferingInterface() = default;
391 
395  virtual void SetBufferLength(const BufferLength &bufferLength) = 0;
396 
400  virtual BufferLength GetBufferLength() const = 0;
401  };
402 
409  {
410  // ID3 Related Keys
415 
416  // DASH Event Message Related Keys
446  static const CYIString EventMessageId;
451  };
452 
457  {
461  TimedMetadata();
462 
465  std::chrono::microseconds timestamp;
466  std::chrono::microseconds duration;
467  std::map<CYIString, CYIString> additionalData;
468  };
469 
476  {
477  public:
478  virtual ~TimedMetadataInterface() = default;
479 
486  };
487 
494  {
495  public:
503  {
504  public:
505  virtual ~ControlsHandler() = default;
506 
510  virtual void OnPlay(CYIAbstractVideoPlayer *pPlayer);
511 
515  virtual void OnPause(CYIAbstractVideoPlayer *pPlayer);
516 
520  virtual void OnSeek(CYIAbstractVideoPlayer *pPlayer, uint64_t positionMs);
521 
525  virtual void OnStop(CYIAbstractVideoPlayer *pPlayer);
526 
530  virtual void OnClosedCaptionsEnabled(CYIAbstractVideoPlayer *pPlayer, bool enabled);
531  };
532 
533  virtual ~MediaPlaybackControlsInterface() = default;
534 
542  virtual void EnableMediaPlaybackControl(bool enabled) = 0;
543 
547  virtual bool IsMediaPlaybackControlEnabled() const = 0;
548 
554  virtual void SetControlsHandler(ControlsHandler *pControlsHandler) = 0;
555  };
556 
567  {
568  public:
569  virtual ~NetworkTimeoutInterface() = default;
570 
574  virtual void SetConnectionTimeout(std::chrono::milliseconds timeout) = 0;
575 
579  virtual std::chrono::milliseconds GetConnectionTimeout() const = 0;
580 
584  virtual void SetRequestTimeout(std::chrono::milliseconds timeout) = 0;
585 
589  virtual std::chrono::milliseconds GetRequestTimeout() const = 0;
590  };
591 
596  {
597  public:
598  virtual ~LiveSessionInterface() = default;
599 
605  virtual void SetLivePresentationDelay(std::chrono::milliseconds liveDelay) = 0;
606  };
607 
612  {
613  public:
614  virtual ~AdaptiveResolutionInterface() = default;
615 
621  virtual void SetMaxResolution(glm::ivec2 maxResolution) = 0;
622  };
623 
624  virtual ~CYIAbstractVideoPlayer();
625 
629  CYIString GetName() const;
630 
637  CYIString GetVersion() const;
638 
644  struct Statistics
645  {
651  Statistics();
652 
653  bool operator==(const Statistics &other) const;
654  bool operator!=(const Statistics &other) const;
655 
659  bool isLive;
660 
667 
674 
681 
688 
695 
702 
709 
716 
723 
730  };
731 
735  Statistics GetStatistics() const;
736 
742  void Init();
743 
757  void Prepare(const CYIUrl &videoURI, StreamingFormat formatHint, CYIAbstractVideoPlayer::PlaybackState initialState = CYIAbstractVideoPlayer::PlaybackState::Paused, std::unique_ptr<DRMConfiguration> pDRMConfiguration = nullptr, uint64_t startTimeMs = 0);
758 
764  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);
765 
771  void Play();
772 
778  void Pause();
779 
783  void Stop();
784 
792  {
796  SeekableRange(uint64_t startTimeMs, uint64_t endTimeMs)
797  : startTimeMs(startTimeMs)
798  , endTimeMs(endTimeMs)
799  {
800  }
801 
805  uint64_t startTimeMs;
806 
810  uint64_t endTimeMs;
811  };
812 
820  std::vector<SeekableRange> GetLiveSeekableRanges() const;
821 
827  void Seek(uint64_t seekPositionMs);
828 
832  bool SupportsFormat(StreamingFormat streamingFormat, DRMScheme drmScheme = DRMScheme::None);
833 
837  uint64_t GetDurationMs() const;
838 
842  uint64_t GetCurrentTimeMs() const;
843 
850 
865  std::shared_ptr<CYIPlatformPlayerHandle> GetPlatformPlayerHandle() const;
866 
881  std::shared_ptr<CYIPlatformViewHandle> GetPlatformPlayerContainerViewHandle() const;
882 
888  void SetClosedCaptionsEnabled(bool enabled);
889 
898 
911  bool SelectClosedCaptionsTrack(uint32_t id);
912 
923  std::vector<ClosedCaptionsTrackInfo> GetClosedCaptionsTracks() const;
924 
933 
934  /*
935  \details Returns the closed captions dispatcher for the player.
936 
937  This will return null if the player implementation does not provide control over closed captions rendering.
938  */
940 
944  CYIVideoSurface *GetSurface() const;
945 
951  bool AreAudioTracksAvailable() const;
952 
962  bool SelectAudioTrack(uint32_t id);
963 
974  std::vector<AudioTrackInfo> GetAudioTracks() const;
975 
984 
988  bool IsMuted() const;
989 
993  void Mute(bool mute);
994 
1001  uint64_t GetMinimumTimeUpdateIntervalMs() const;
1002 
1009  void SetMinimumTimeUpdateIntervalMs(uint64_t minimumTimeUpdateIntervalMs);
1010 
1020  void SetMaxBitrate(uint64_t maxBitrate);
1021 
1029  void SetInitialBandwidthHint(uint64_t initialBandwidthHint);
1030 
1042  void SetUserAgent(const CYIString &userAgent);
1043 
1051  const DRMConfiguration *GetDRMConfiguration() const;
1052 
1061 
1067 
1073 
1079 
1090 
1096 
1102 
1108 
1114 
1118  using RefreshDRMConfigurationCallback = std::function<std::unique_ptr<CYIAbstractVideoPlayer::DRMConfiguration>(std::unique_ptr<CYIAbstractVideoPlayer::DRMConfiguration>)>;
1120 
1126  CYISignal<std::shared_ptr<CYIPlatformPlayerHandle> /* pNewHandle */, std::shared_ptr<CYIPlatformPlayerHandle> /* pPreviousHandle */> PlatformPlayerHandleChanged;
1127 
1133  CYISignal<std::shared_ptr<CYIPlatformViewHandle> /* pNewHandle */, std::shared_ptr<CYIPlatformViewHandle> /* pPreviousHandle */> PlatformPlayerContainerViewHandleChanged;
1134 
1141 
1148 
1155 
1160 
1165 
1170 
1175 
1181 
1187 
1193 
1199 
1204 
1209 
1214 
1219 
1224 
1229 
1234 
1235 protected:
1237 
1241  const std::shared_ptr<CYIMaterial> &GetVideoMaterial() const;
1242 
1248  void SetPlatformPlayerHandle(std::shared_ptr<CYIPlatformPlayerHandle> pPlatformPlayerHandle);
1249 
1255  void SetPlatformPlayerContainerViewHandle(std::shared_ptr<CYIPlatformViewHandle> pPlatformPlayerContainerViewHandle);
1256 
1260  void SetVideoSurfaceSize(const glm::ivec2 &size);
1261 
1266 
1271 
1276 
1280  void UpdateCurrentTime();
1281 
1286 
1292 
1298 
1304 
1311 
1317  std::unique_ptr<CYIVideoPlayerStateManager> m_pStateManager;
1318 
1325  std::unique_ptr<CYIClosedCaptionsDispatcher> m_pClosedCaptionsDispatcher;
1326 
1333  std::unique_ptr<DRMConfiguration> m_pDRMConfiguration;
1334 
1338  uint64_t m_maxBitrate;
1339 
1344 
1348  glm::ivec2 m_maxResolution;
1349 
1356 
1361 
1362 private:
1363  struct SeekState
1364  {
1365  enum class Direction
1366  {
1367  Forward,
1368  Reverse
1369  };
1370 
1371  bool active;
1372  Direction direction;
1373  uint64_t requestedPositionMs;
1374  uint64_t positionBeforeSeekMs;
1375  };
1376 
1377 #if defined(DOXY)
1378  // We want to document this private section because users override these methods called by the abstract player.
1379 protected:
1380 #endif
1381 
1385  virtual CYIString GetName_() const;
1386 
1392  virtual CYIString GetVersion_() const;
1393 
1397  virtual Statistics GetStatistics_() const;
1398 
1399  /*
1400  \details Subclasses can extend this function to do additional work outside of the constructor for initializing the player.
1401 
1402  \sa #Init
1403  */
1404  virtual void Init_();
1405 
1406  /*
1407  \details Subclasses must implement this function to create the correct CYIVideoSurface instance for the CYIAbstractVideoPlayer implementation.
1408 
1409  \note The surface will be stored in m_pVideoSurface and will be cleaned up automatically.
1410  */
1411  virtual std::unique_ptr<CYIVideoSurface> CreateSurface_() = 0;
1412 
1418  virtual bool SupportsFormat_(StreamingFormat streamingFormat, DRMScheme drmScheme = DRMScheme::None) const = 0;
1419 
1425  virtual bool HasNativeStartTimeHandling_() const;
1426 
1432  virtual bool HasNativeBitrateEventHandling_() const;
1433 
1442  virtual bool HasNativeSeekEventHandling_() const;
1443 
1451  virtual bool HasInitialBandwidthHintHandling_() const;
1452 
1474  virtual void Prepare_(const CYIUrl &videoURI, StreamingFormat format) = 0;
1475 
1485  virtual void Play_() = 0;
1486 
1496  virtual void Pause_() = 0;
1497 
1503  virtual void Stop_() = 0;
1504 
1510  virtual uint64_t GetDurationMs_() const = 0;
1511 
1517  virtual uint64_t GetCurrentTimeMs_() const = 0;
1518 
1524  virtual std::vector<SeekableRange> GetLiveSeekableRanges_() const = 0;
1525 
1531  virtual void Seek_(uint64_t seekPositionMS) = 0;
1532 
1541  virtual bool SelectAudioTrack_(uint32_t id) = 0;
1542 
1550  virtual std::vector<AudioTrackInfo> GetAudioTracks_() const = 0;
1551 
1561 
1567  virtual bool IsMuted_() const = 0;
1568 
1572  virtual void Mute_(bool mute) = 0;
1573 
1577  virtual void DisableClosedCaptions_() = 0;
1578 
1587  virtual bool SelectClosedCaptionsTrack_(uint32_t id) = 0;
1588 
1596  virtual std::vector<ClosedCaptionsTrackInfo> GetClosedCaptionsTracks_() const = 0;
1597 
1607 
1615  virtual void GetClosedCaptionsDispatcher_() const;
1616 
1620  virtual void SetMaxBitrate_(uint64_t maxBitrate);
1621 
1625  virtual void SetUserAgent_(const CYIString &userAgent);
1626 
1631 
1635  virtual const HeadphoneJackInterface *GetHeadphoneJackInterface_() const;
1636 
1640  virtual const BufferingInterface *GetBufferingInterface_() const;
1641 
1645  virtual const TimedMetadataInterface *GetTimedMetadataInterface_() const;
1646 
1651 
1656 
1661 
1665  virtual const LiveSessionInterface *GetLiveSessionInterface_() const;
1666 
1671 
1672 #if defined(DOXY)
1673 private:
1674 #endif
1675 
1676  void CheckAndNotifyAudioTracksChanged();
1677  void CheckAndNotifyClosedCaptionsTracksChanged();
1678  void CheckAndNotifyBitrateChanged();
1679  void OnNotifyErrorOccurred(Error error);
1680  void OnNotifyPlaybackComplete();
1681  void OnNotifyDurationChanged(uint64_t duration);
1682  void UpdateSeekState(uint64_t positionBeforeSeekMs, uint64_t requestedPositionMs);
1683  void OnNotifySeekCompleted(bool success, uint64_t positionAfterSeekMs);
1684  void ClearCachedTrackData();
1685  void OnStateReady();
1686  void OnStateUnloaded();
1687  void ClearClosedCaptions();
1688  void SetTimeUpdatesEnabled(bool enabled);
1689  void ClampSeekPositionToSeekableRange(uint64_t &seekPositionMs);
1690 
1691  std::shared_ptr<CYIPlatformPlayerHandle> m_pPlatformPlayerHandle;
1692  std::shared_ptr<CYIPlatformViewHandle> m_pPlatformPlayerContainerViewHandle;
1693 
1694  bool m_audioTracksAvailable;
1695  std::vector<AudioTrackInfo> m_audioTracksCache;
1696 
1697  float m_cachedTotalBitrate;
1698  float m_cachedVideoBitrate;
1699  float m_cachedAudioBitrate;
1700 
1701  std::unique_ptr<CYIVideoSurface> m_pVideoSurface;
1702  uint64_t m_lastNotifiedTime;
1703  PlaybackState m_initialPlaybackState;
1704  PlaybackState m_requestedInitialPlaybackState;
1705  CYITimer m_mediaTracksRefreshTimer;
1706  CYITimer m_bitrateRefreshTimer;
1707  CYITimer m_pTimeUpdateTimer;
1708  bool m_isMuted;
1709  SeekState m_seekState;
1710  uint64_t m_minimumTimeUpdateIntervalMs;
1711 
1712  bool m_closedCaptionsTracksAvailable;
1713  std::vector<ClosedCaptionsTrackInfo> m_closedCaptionsTracksCache;
1714  uint32_t m_previousClosedCaptionsTrackId;
1715  static const ClosedCaptionsTrackInfo CLOSED_CAPTIONS_OFF_TRACK;
1716 
1719 };
1720 
1725 // Audio tracks
1728 
1729 // Closed captions tracks
1730 bool operator==(const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackL, const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackR);
1731 bool operator!=(const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackL, const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackR);
1732 
1733 // Timed Metadata
1734 bool operator==(const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataL, const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataR);
1735 bool operator!=(const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataL, const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataR);
1736 
1737 //States
1738 bool operator==(const CYIAbstractVideoPlayer::PlayerState &playerStateL, const CYIAbstractVideoPlayer::PlayerState &playerStateR);
1739 bool operator==(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::MediaState &mediaState);
1740 bool operator==(const CYIAbstractVideoPlayer::MediaState &mediaState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1741 bool operator==(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::PlaybackState &playbackState);
1742 bool operator==(const CYIAbstractVideoPlayer::PlaybackState &playbackState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1743 
1744 bool operator!=(const CYIAbstractVideoPlayer::PlayerState &playerStateL, const CYIAbstractVideoPlayer::PlayerState &playerStateR);
1745 bool operator!=(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::MediaState &mediaState);
1746 bool operator!=(const CYIAbstractVideoPlayer::MediaState &mediaState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1747 bool operator!=(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::PlaybackState &playbackState);
1748 bool operator!=(const CYIAbstractVideoPlayer::PlaybackState &playbackState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1749 
1750 #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:195
virtual void SetMaxBitrate_(uint64_t maxBitrate)
std::vector< ClosedCaptionsTrackInfo > GetClosedCaptionsTracks() const
virtual const NetworkTimeoutInterface * GetNetworkTimeoutInterface_() const
static const CYIString ID3PrivateFrameOwner
Definition: YiAbstractVideoPlayer.h:414
MediaPlaybackControlsInterface * GetMediaPlaybackControlsInterface()
virtual void SetUserAgent_(const CYIString &userAgent)
CYISignal PlaybackComplete
Definition: YiAbstractVideoPlayer.h:1180
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:69
CYIRuntimeTypeInfo::NonInstantiableTag RTTIInstantiatability
Definition: YiAbstractVideoPlayer.h:64
CYIVideoSurface * GetSurface() const
Definition: YiAbstractVideoPlayer.h:206
CYISignal< float > AudioBitrateChanged
Definition: YiAbstractVideoPlayer.h:1233
float renderedFramesPerSecond
Definition: YiAbstractVideoPlayer.h:722
Definition: YiAbstractVideoPlayer.h:387
Definition: YiAbstractVideoPlayer.h:350
std::map< CYIString, CYIString > additionalData
Definition: YiAbstractVideoPlayer.h:467
uint64_t m_initialBandwidthHint
Definition: YiAbstractVideoPlayer.h:1343
std::unique_ptr< DRMConfiguration > m_pDRMConfiguration
Definition: YiAbstractVideoPlayer.h:1333
void SetClosedCaptionsEnabled(bool enabled)
NetworkTimeoutInterface * GetNetworkTimeoutInterface()
virtual bool IsMuted_() const =0
Definition: YiAbstractVideoPlayer.h:180
Statistics GetStatistics() const
void ChangeInitialPlaybackState(CYIAbstractVideoPlayer::PlaybackState initialState)
virtual std::vector< SeekableRange > GetLiveSeekableRanges_() const =0
void SetMinimumTimeUpdateIntervalMs(uint64_t minimumTimeUpdateIntervalMs)
ClosedCaptionsTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
Definition: YiAbstractVideoPlayer.h:237
CYISignal< std::vector< ClosedCaptionsTrackInfo > > AvailableClosedCaptionsTracksChanged
Definition: YiAbstractVideoPlayer.h:1218
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:32
uint64_t GetMinimumTimeUpdateIntervalMs() const
CYISignal BufferingEnded
Definition: YiAbstractVideoPlayer.h:1147
float bufferLengthMs
Definition: YiAbstractVideoPlayer.h:708
CYISignal< Error > ErrorOccurred
Definition: YiAbstractVideoPlayer.h:1154
bool SupportsFormat(StreamingFormat streamingFormat, DRMScheme drmScheme=DRMScheme::None)
BackgroundPlaybackInterface * GetBackgroundPlaybackInterface()
AudioTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
Definition: YiAbstractVideoPlayer.h:214
Definition: YiAbstractVideoPlayer.h:566
virtual std::unique_ptr< CYIVideoSurface > CreateSurface_()=0
CYISignal< std::shared_ptr< CYIPlatformViewHandle >, std::shared_ptr< CYIPlatformViewHandle > > PlatformPlayerContainerViewHandleChanged
Definition: YiAbstractVideoPlayer.h:1133
TimedMetadataInterface * GetTimedMetadataInterface()
std::function< std::unique_ptr< CYIAbstractVideoPlayer::DRMConfiguration >(std::unique_ptr< CYIAbstractVideoPlayer::DRMConfiguration >)> RefreshDRMConfigurationCallback
Definition: YiAbstractVideoPlayer.h:1118
static const CYIString EventMessagePTSDelta
Definition: YiAbstractVideoPlayer.h:436
CYISignal Preparing
Definition: YiAbstractVideoPlayer.h:1159
CYISignal< const CYIAbstractVideoPlayer::PlayerState & > PlayerStateChanged
Definition: YiAbstractVideoPlayer.h:1208
bool operator!=(const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackL, const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackR)
uint64_t startTimeMs
Definition: YiAbstractVideoPlayer.h:805
Definition: YiAbstractVideoPlayer.h:316
ClosedCaptionsTrackInfo()
Definition: YiAbstractVideoPlayer.h:233
CYIString value
Definition: YiAbstractVideoPlayer.h:464
std::shared_ptr< CYIPlatformViewHandle > GetPlatformPlayerContainerViewHandle() const
const std::shared_ptr< CYIMaterial > & GetVideoMaterial() const
static const CYIString EventMessageValue
Definition: YiAbstractVideoPlayer.h:426
TrackInfo(uint32_t id)
Definition: YiAbstractVideoPlayer.h:186
CYIMaterial is a place holder for all the drawing parameters required by the renderer to draw a mesh/...
Definition: YiMaterial.h:29
ClosedCaptionsTrackInfo(const TrackInfo &trackInfo)
Definition: YiAbstractVideoPlayer.h:241
virtual const VideoRequestHTTPHeadersInterface * GetVideoRequestHTTPHeadersInterface_() const
CYISignal Finalized
Definition: YiAbstractVideoPlayer.h:1186
bool SelectClosedCaptionsTrack(uint32_t id)
CYISignal Ready
Definition: YiAbstractVideoPlayer.h:1164
static const CYIString EventMessageMessageData
Definition: YiAbstractVideoPlayer.h:450
virtual CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo GetActiveClosedCaptionsTrack_() const =0
std::chrono::milliseconds min
Definition: YiAbstractVideoPlayer.h:355
virtual bool SelectClosedCaptionsTrack_(uint32_t id)=0
CYISignal< std::shared_ptr< CYIPlatformPlayerHandle >, std::shared_ptr< CYIPlatformPlayerHandle > > PlatformPlayerHandleChanged
Definition: YiAbstractVideoPlayer.h:1126
HeadphoneJackInterface * GetHeadphoneJackInterface()
AudioTrackInfo(const TrackInfo &trackInfo)
Definition: YiAbstractVideoPlayer.h:219
virtual const HeadphoneJackInterface * GetHeadphoneJackInterface_() const
float defaultAudioBitrateKbps
Definition: YiAbstractVideoPlayer.h:701
TrackInfo(uint32_t id, const CYIString &name)
Definition: YiAbstractVideoPlayer.h:190
Definition: YiAbstractVideoPlayer.h:293
CYISignal< float > TotalBitrateChanged
Definition: YiAbstractVideoPlayer.h:1223
CYISignal< bool, uint64_t > NotifySeekCompleted
Definition: YiAbstractVideoPlayer.h:1310
static const CYIString EventMessageDuration
Definition: YiAbstractVideoPlayer.h:442
static uint32_t DEFAULT_TRACK_ID
Definition: YiAbstractVideoPlayer.h:208
MediaState mediaState
Definition: YiAbstractVideoPlayer.h:97
void SetPlatformPlayerHandle(std::shared_ptr< CYIPlatformPlayerHandle > pPlatformPlayerHandle)
An interface to adjust playback quality through resolution.
Definition: YiAbstractVideoPlayer.h:611
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:1228
virtual ~CYIAbstractVideoPlayer()
CYISignal BufferingStarted
Definition: YiAbstractVideoPlayer.h:1140
Definition: YiAbstractVideoPlayer.h:408
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:59
CYISignal< uint64_t > CurrentTimeUpdated
Definition: YiAbstractVideoPlayer.h:1192
ErrorCode errorCode
Definition: YiAbstractVideoPlayer.h:172
Definition: YiAbstractVideoPlayer.h:95
CYISignal Paused
Definition: YiAbstractVideoPlayer.h:1174
bool isValid
Definition: YiAbstractVideoPlayer.h:224
virtual Statistics GetStatistics_() const
uint64_t endTimeMs
Definition: YiAbstractVideoPlayer.h:810
static const CYIString EventMessageSchemeId
Definition: YiAbstractVideoPlayer.h:420
RefreshDRMConfigurationCallback m_refreshDRMConfigurationCallback
Definition: YiAbstractVideoPlayer.h:1360
Definition: YiAbstractVideoPlayer.h:456
CYIAbstractVideoPlayer::PlaybackState GetRequestedInitialPlaybackState() const
Definition: YiAbstractVideoPlayer.h:165
virtual bool HasNativeBitrateEventHandling_() const
uint32_t id
Definition: YiAbstractVideoPlayer.h:182
virtual const MediaPlaybackControlsInterface * GetMediaPlaybackControlsInterface_() const
A low-precision timer driven by the update loop.
Definition: YiTimer.h:27
bool AreAudioTracksAvailable() const
virtual bool SelectAudioTrack_(uint32_t id)=0
float minimumBufferLengthMs
Definition: YiAbstractVideoPlayer.h:715
CYISignal NotifyPlaybackComplete
Definition: YiAbstractVideoPlayer.h:1297
virtual void Pause_()=0
PlaybackState
Definition: YiAbstractVideoPlayer.h:85
virtual std::vector< AudioTrackInfo > GetAudioTracks_() const =0
CYIString nativePlayerErrorCode
Definition: YiAbstractVideoPlayer.h:174
uint64_t m_initialStartTimeMs
Definition: YiAbstractVideoPlayer.h:1355
void Mute(bool mute)
CYISignal< uint64_t > DurationChanged
Definition: YiAbstractVideoPlayer.h:1198
virtual void Seek_(uint64_t seekPositionMS)=0
float totalBitrateKbps
Definition: YiAbstractVideoPlayer.h:666
glm::ivec2 m_maxResolution
Definition: YiAbstractVideoPlayer.h:1348
bool SelectAudioTrack(uint32_t id)
SeekableRange(uint64_t startTimeMs, uint64_t endTimeMs)
Definition: YiAbstractVideoPlayer.h:796
PlaybackState playbackState
Definition: YiAbstractVideoPlayer.h:98
CYIAbstractVideoPlayer::PlayerState GetPlayerState() const
bool isLive
Definition: YiAbstractVideoPlayer.h:659
The base class for all DRM configurations.
Definition: YiAbstractVideoPlayer.h:135
float defaultTotalBitrateKbps
Definition: YiAbstractVideoPlayer.h:687
std::chrono::milliseconds max
Definition: YiAbstractVideoPlayer.h:360
BufferingInterface * GetBufferingInterface()
Definition: YiAbstractVideoPlayer.h:252
AdaptiveResolutionInterface * GetAdaptiveResolutionInterface()
uint64_t m_maxBitrate
Definition: YiAbstractVideoPlayer.h:1338
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:465
CYISignal Playing
Definition: YiAbstractVideoPlayer.h:1169
virtual const BufferingInterface * GetBufferingInterface_() const
std::unique_ptr< CYIVideoPlayerStateManager > m_pStateManager
Definition: YiAbstractVideoPlayer.h:1317
float audioBitrateKbps
Definition: YiAbstractVideoPlayer.h:680
Definition: YiSignalHandler.h:175
static uint32_t OFF_TRACK_ID
Definition: YiAbstractVideoPlayer.h:232
CYIString message
Definition: YiAbstractVideoPlayer.h:173
virtual const BackgroundPlaybackInterface * GetBackgroundPlaybackInterface_() const
std::vector< AudioTrackInfo > GetAudioTracks() const
CYISignal< bool, uint64_t > SeekCompleted
Definition: YiAbstractVideoPlayer.h:1203
bool operator==(const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackL, const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackR)
void SetUserAgent(const CYIString &userAgent)
CYIString GetName() const
CYIString name
Definition: YiAbstractVideoPlayer.h:183
ErrorCode
Definition: YiAbstractVideoPlayer.h:151
LiveSessionInterface * GetLiveSessionInterface()
Definition: YiAbstractVideoPlayer.h:475
static const CYIString EventMessageTimescale
Definition: YiAbstractVideoPlayer.h:430
StreamingFormat
Definition: YiAbstractVideoPlayer.h:106
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:362
Definition: YiAbstractVideoPlayer.h:644
An interface to adjust playback of live streams.
Definition: YiAbstractVideoPlayer.h:595
void CheckAndNotifyMediaTracksChanged()
MediaState
Definition: YiAbstractVideoPlayer.h:72
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:371
void SetMaxBitrate(uint64_t maxBitrate)
const DRMConfiguration * GetDRMConfiguration() const
std::unique_ptr< CYIClosedCaptionsDispatcher > m_pClosedCaptionsDispatcher
Definition: YiAbstractVideoPlayer.h:1325
uint64_t GetDurationMs() const
void SetInitialBandwidthHint(uint64_t initialBandwidthHint)
static const CYIString EventMessageId
Definition: YiAbstractVideoPlayer.h:446
CYISignal< uint64_t > NotifyDurationChanged
Definition: YiAbstractVideoPlayer.h:1303
void SetVideoSurfaceSize(const glm::ivec2 &size)
void Seek(uint64_t seekPositionMs)
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:259
float videoBitrateKbps
Definition: YiAbstractVideoPlayer.h:673
std::shared_ptr< CYIPlatformPlayerHandle > GetPlatformPlayerHandle() const
void SetPlatformPlayerContainerViewHandle(std::shared_ptr< CYIPlatformViewHandle > pPlatformPlayerContainerViewHandle)
Definition: YiAbstractVideoPlayer.h:493
float encodedFramesPerSecond
Definition: YiAbstractVideoPlayer.h:729
float defaultVideoBitrateKbps
Definition: YiAbstractVideoPlayer.h:694
CYISignal< std::vector< AudioTrackInfo > > AvailableAudioTracksChanged
Definition: YiAbstractVideoPlayer.h:1213
virtual const TimedMetadataInterface * GetTimedMetadataInterface_() const
virtual CYIString GetName_() const
AudioTrackInfo()
Definition: YiAbstractVideoPlayer.h:209
virtual void Init_()
CYIString identifier
Definition: YiAbstractVideoPlayer.h:463
std::chrono::microseconds duration
Definition: YiAbstractVideoPlayer.h:466
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:35
CYISignal< TimedMetadata > MetadataAvailable
Definition: YiAbstractVideoPlayer.h:485
ClosedCaptionsTrackInfo GetActiveClosedCaptionsTrack() const
CYIString language
Definition: YiAbstractVideoPlayer.h:184
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:169
std::vector< SeekableRange > GetLiveSeekableRanges() const
virtual void Mute_(bool mute)=0
virtual const LiveSessionInterface * GetLiveSessionInterface_() const
Asset representing a video.
Definition: YiAssetVideo.h:20
DRMScheme
Definition: YiAbstractVideoPlayer.h:119
virtual bool HasNativeStartTimeHandling_() const
virtual bool HasNativeSeekEventHandling_() const
The CYIPlatformViewHandle is a wrapper object that holds on to the native platform view...
Definition: YiPlatformViewHandle.h:22
virtual std::vector< ClosedCaptionsTrackInfo > GetClosedCaptionsTracks_() const =0
CYISignal< Error > NotifyErrorOccurred
Definition: YiAbstractVideoPlayer.h:1291
Representation of a CYIAbstractVideoPlayer&#39;s video surface.
Definition: YiVideoSurface.h:34
virtual void Play_()=0
CYIString GetVersion() const
The CYIPlatformPlayerHandle is a wrapper object that holds on to the native platform player instance...
Definition: YiPlatformPlayerHandle.h:25
Definition: YiAbstractVideoPlayer.h:230
virtual const AdaptiveResolutionInterface * GetAdaptiveResolutionInterface_() const
Error()
Definition: YiAbstractVideoPlayer.h:167
virtual uint64_t GetCurrentTimeMs_() const =0
Definition: YiAbstractVideoPlayer.h:791
virtual bool SupportsFormat_(StreamingFormat streamingFormat, DRMScheme drmScheme=DRMScheme::None) const =0
VideoRequestHTTPHeadersInterface * GetVideoRequestHTTPHeadersInterface()