Hi @keerthi0555
Please try below 2 examples
Ex1:
Check if the issue is related to caching. It's possible that the video is being cached on the iPhone and not being refreshed when switching between tabs. You can try adding a cache-busting parameter to the video URL to force the browser to fetch a fresh copy of the video each time it's played.
Check if the issue is related to the video format. iPhones have specific requirements for video playback, so it's possible that the video format being used is not compatible with iOS. You can try converting the video to a different format that is known to work well on iPhones.
Check if the issue is related to the video player. It's possible that the video player being used is not compatible with iOS. You can try using a different video player or updating the existing player to a newer version that is known to work well on iPhones.
Ex2:
Safari has strict autoplay policies. Ensure that your video elements comply with these policies. Autoplaying videos are generally allowed only if muted. If your videos are not muted, consider adding the muted attribute to your video elements.
-----------
<video muted controls>
<source src="your_video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
--------------------
Page Visibility API:
Safari and other browsers may pause background tabs to conserve resources. You can use the Page Visibility API to check if the tab is visible before playing the video.
----------------------
document.addEventListener('visibilitychange', function() {
if (document.visibilityState === 'visible') {
// Code to play the video
}
});
---------------------------
iOS Specific Considerations:
iOS devices may behave differently, and there could be limitations or issues specific to Safari on iOS. Ensure that your videos are encoded using formats and settings that are well-supported on iOS. H.264 is a commonly supported video codec on iOS devices.
Thanks.