Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated to latest version 1.6.1, player autoplays hls, even when using playing={false} attribute #405

Closed
iambumblehead opened this issue May 21, 2018 · 14 comments

Comments

@iambumblehead
Copy link

iambumblehead commented May 21, 2018

updated to latest version 1.6.1, player autoplays hls, even when using playing={false} attribute

@iambumblehead iambumblehead changed the title updated to latest version 1.5.1, player autoplays hls, even when using playing={false} attribute updated to latest version 1.6.1, player autoplays hls, even when using playing={false} attribute May 21, 2018
@iambumblehead
Copy link
Author

version 1.5.0 seems to be the last version that respects the playing attribute

@kumarharsh
Copy link

kumarharsh commented May 23, 2018

It's Chrome 66 which is blocking autoplay. Autoplay works for v1.6.1 in Firefox, etc.

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

Open this fiddle (uses v1.6.1) in different browsers: https://codesandbox.io/s/1qjmkkxrv7?view=preview

@cookpete
Copy link
Owner

@kumarharsh I think the problem is that it is autoplaying, not that it is not autoplaying.

@kumarharsh
Copy link

kumarharsh commented May 23, 2018

oh, I see. Sorry for the misunderstanding. But still, it seems to be working as expected for me (try changing the props in the fiddle above). I'm an idiot. The OP is talking about hls media, not youtube. 🙄 Sorry for the confusion.

@cookpete
Copy link
Owner

@iambumblehead do you have a jsFiddle or example URL where this is happening? What browser are you using? This doesn't happen on the demo app on Chrome. Click Pause to set playing to false, then HLS (m3u8), and the video does not play.

@iambumblehead
Copy link
Author

@cookpete unfortunately I don't have a jsFiddle and I don't believe the demo app can be used to test this scenario. The right test scenario would load using the react-player component with an hls video source and playing={false}

@cookpete
Copy link
Owner

@iambumblehead How about https://jsfiddle.net/xymyj0e1/ – this doesn't play for me on any browser.

@iambumblehead
Copy link
Author

@cookpete the jsfiddle link doesn't play for me either. I'll paste this in to my own application and see if I can get to the bottom of things now.

@iambumblehead
Copy link
Author

iambumblehead commented May 25, 2018

I'm using firefox and if I paste that into my application using 1.6.1 react-player, the video autoplays

<ReactPlayer
  url='https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8'
  className='react-player'
  playing={false}
  width='100%'
  height='100%' />

@iambumblehead
Copy link
Author

iambumblehead commented May 25, 2018

The jsfiddle page uses react-player sources here and notice the version number in the url: https://unpkg.com/react-player@1.0.0-beta.5/dist/ReactPlayer.js

Specifcally, a react-player version greater than 1.5.0 should be used in order to reproduce the issue

@cookpete
Copy link
Owner

Good spot.

It still doesn't autoplay for me when using 1.6.1: https://jsfiddle.net/6fo1cn5x/

@iambumblehead
Copy link
Author

iambumblehead commented May 25, 2018

strange. The demo page does not autoplay when I load it. Locally, when I use 1.6.1 and paste the react-player component jsx from the demo page into my own app it does autoplay. I'm not seeing any scripted play calls in my own sources and will try to narrow things down further by remove everything else from my app.

edit: I've made this the only component rendered by my app and disabled everything else and it still auto plays

@iambumblehead
Copy link
Author

iambumblehead commented May 25, 2018

It autoplays in both firefox and chrome. I notice that when the

<video preload="auto" autoplay="false" src="src" style="width: 100%; height: 100%;"></video>

 autoplay: autoplay || undefined,

The

@iambumblehead
Copy link
Author

iambumblehead commented May 25, 2018

I've tested this locally (not defining autoplay if autoplay is not truthy) and that did resolve the issue here

I edited lib/players/FilePlayer.js to use this autoPlay attribute

          autoPlay: playing || undefined,

david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue Dec 23, 2018
david-hub024 added a commit to david-hub024/React_VideoPlayer that referenced this issue May 23, 2020
albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants