Skip to content

Commit

Permalink
Merge pull request #3 from nteske/main
Browse files Browse the repository at this point in the history
dev: IOS AutoPlay Fixed
  • Loading branch information
nteske authored Sep 27, 2021
2 parents c6e6ed5 + 2ca5f4f commit 8658322
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions widget/controllers/widget.media.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
WidgetMedia.onPlayerReady = function ($API) {
WidgetMedia.API = $API;
WidgetMedia.loadingVideo = true;
WidgetMedia.fixIOSAutoPlay();

if ($rootScope.autoPlay) {
// Make sure the audio is turned off
Expand All @@ -96,6 +97,14 @@
}
};

WidgetMedia.fixIOSAutoPlay = function (){ //Ticket https://buildfire.atlassian.net/browse/CS-598
var video=angular.element('video');
if($rootScope.autoPlay)
video.attr('autoplay', 'autoplay');//Solution https://stackoverflow.com/questions/24057565/video-autoplay-for-ios-not-working-in-app/24063028#24063028
else
video.removeAttr('autoplay');
}

$scope.onVideoStateChange = function(state) {
if (state === 'play') { // The video started playing
// Make sure the audio is turned off
Expand Down Expand Up @@ -286,6 +295,7 @@
$rootScope.autoPlayDelay = typeof WidgetMedia.media.data.content.autoPlayDelay !== 'undefined' ? WidgetMedia.media.data.content.autoPlayDelay : { label: "Off", value: 0 };

// Update Data in media contoller
WidgetMedia.fixIOSAutoPlay();
$rootScope.refreshItems();

WidgetMedia.media.data.design.itemLayout = event.data.design.itemLayout;
Expand Down

0 comments on commit 8658322

Please sign in to comment.