Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Autoplaying a video.

Avatar

Level 1

Hello,

I want to embed a video using the scene7 video player in my webpage, which starts automatically when the page is loaded. For doing this I have set the flag "autoplay" to "1"  like:

var s7_videoview = new s7viewers.VideoViewer({

    "containerId" : "s7_videoview_small",

        "params" : {

        "asset" : "XXX/180726_XXX_HW18_Making-of_Start_short",

        "serverurl" : "https://XXX.scene7.com/is/image/",

        "contenturl": "https://XXXscene7.com/skins/",

        "config": "Scene7SharedAssets/Universal_HTML5_Video",

        "emailurl": "https://coeur.scene7.com/s7/emailFriend",

        "videoserverurl": "https://coeur.scene7.com/is/content/",

        "autoplay": "1",

        "ssl": "on",

        "playback": "progessive",

        "loop": "1"}}).init();

But when I open the page, the video doesn`t start automatically. But when I open the chrome console, to investigate this problem, the video starts automatically.

So can you give me a hint how to make autoplay working ?

Thanks a lot

Andi

1 Accepted Solution

Avatar

Correct answer by
Level 1

thanks gauravb!

This hacky version worked for me on chrome (i am also using jquery):

"handlers" : {

        "initComplete":function() {

          console.log("init complete");

          $("#my-video_videoPlayer video").prop('muted', true);

          $("#my-video_videoPlayer video")[0].play();

        }

      }

View solution in original post

10 Replies

Avatar

Community Advisor

I guess this issue may be related to recent Chrome policy change - Autoplay Policy Changes  |  Web  |  Google Developers

Regards

Albin I

www.albinsblog.com

Avatar

Level 6

If we want audio also to play along with autoplaying video with scene7

Avatar

Level 1

Hi Albin,

thanks for your a nswer! Base on this answer, I assume, that the "autoplay" only work when I mute the video... But the I didn`t find any possibilty to mute the "Scene7 video player". Do you know, how I can mute the video player?

Best regards

Andi

Avatar

Level 10

Not sure if this would work but you may try --

"handlers":{

  "initComplete":function() {

  videoViewer.getComponent("mutableVolume").setPosition(0);

  videoViewer.getComponent("mutableVolume").deactivate();

  }

  }

Source:  Mutable volume

Avatar

Level 1

Thanks gauravb10066713 and smacdonald2008​.  Is this initialization compatible with the policies set out by by google and apple/webkit?

"By default, WebKit will have the following policies:

<video muted> elements will also be allowed to autoplay without a user gesture."

https://webkit.org/blog/6784/new-video-policies-for-ios/

"Chrome's autoplay policies are simple:

Muted autoplay is always allowed."

https://developers.google.com/web/updates/2017/09/autoplay-policy-changes

Avatar

Level 10

I don't think so because that line of code simply sets the volume to zero rather than muting it which may be a problem. I know 'muted' property works fine but I couldn't find the same in its handler.

That's the reason I asked to test and see how each browser reacts to it. Would be good to know if browsers support this trick or not.

Avatar

Correct answer by
Level 1

thanks gauravb!

This hacky version worked for me on chrome (i am also using jquery):

"handlers" : {

        "initComplete":function() {

          console.log("init complete");

          $("#my-video_videoPlayer video").prop('muted', true);

          $("#my-video_videoPlayer video")[0].play();

        }

      }

Avatar

Level 6

why playback:progressive what impact it gives to the video?