wxxsw / GSPlayer

⏯ Video player, support for caching, preload, fullscreen transition and custom control view. 视频播放器,支持边下边播、预加载、全屏转场和自定义控制层
MIT License
433 stars 101 forks source link

Add Support for Placeholder and Loading Indicator during Video Load #100

Open abbasnaqvi200 opened 2 months ago

abbasnaqvi200 commented 2 months ago

Feature Request: It would be great if the GSPlayer library could include support for displaying a placeholder image and a loading indicator (e.g., UIActivityIndicatorView) when a video is taking time to load or buffer.

Use Case: When loading videos, especially from a remote URL, there can be a delay before the video is ready to play. During this delay, showing a placeholder image or an activity indicator would significantly improve the user experience by providing visual feedback. This is particularly useful for scenarios where videos take longer to load due to slow internet connections.

Suggested Implementation:

Add properties or methods to VideoPlayerView to set a placeholder image and a loading indicator. Use the player's state (e.g., buffering, readyToPlay) to toggle the visibility of the placeholder and loading indicator.

Expected Behavior:

A placeholder image should be visible until the video starts playing. A loading indicator should be displayed when the video is buffering or loading and hidden once the video is ready to play. This feature would make the library more robust and improve its usability in scenarios where video loading times can vary.