# need help with html code embed



## chanfuterboy (Jun 1, 2018)

i have the following script to play m3u8

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>videojs-contrib-hls embed</title>

  <!--

  Uses the latest versions of video.js and videojs-contrib-hls.

  To use specific versions, please change the URLs to the form:

  <link href="https://unpkg.com/video.js@5.16.0/dist/video-js.css" rel="stylesheet">
  <script src="https://unpkg.com/video.js@5.16.0/dist/video.js"></script>
  <script src="https://unpkg.com/videojs-contrib-hls@4.1.1/dist/videojs-contrib-hls.js"></script>

  -->

  <link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet">
  <script src="https://unpkg.com/video.js/dist/video.js"></script>
  <script src="https://unpkg.com/videojs-contrib-hls/dist/videojs-contrib-hls.js"></script>

</head>
<body>
  <h1>Video.js Example Embed</h1>

  <video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268"
  data-setup='{}'>
    <source src="http://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8" type="application/x-mpegURL">
  </video>

  <script>
  </script>

</body>
</html>




i want someone help me with a line or so, that force when i open in page it play without that i need to press play


----------



## kruk (Jun 1, 2018)

Add autoplay attribute to your video element:


```
<video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268"
data-setup='{}' autoplay>
```

Also use https for your src or the video won't play on https sites (mixed content):


```
<source src="https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8" type="application/x-mpegURL">
```


----------



## chanfuterboy (Jun 1, 2018)

hi,

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>cnn</title>

  <!--

  Uses the latest versions of video.js and videojs-contrib-hls.

  To use specific versions, please change the URLs to the form:

  <link href="https://unpkg.com/video.js@5.16.0/dist/video-js.css" rel="stylesheet">
  <script src="https://unpkg.com/video.js@5.16.0/dist/video.js"></script>
  <script src="https://unpkg.com/videojs-contrib-hls@4.1.1/dist/videojs-contrib-hls.js"></script>

  -->


  <link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet">
  <script src="https://unpkg.com/video.js/dist/video.js"></script>
  <script src="https://unpkg.com/videojs-contrib-hls/dist/videojs-contrib-hls.js"></script>

</head>
<body>


  <video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" 
data-setup='{}' autoplay> 


  <source src="http://149.56.26.63:1935/cnewz/myStream/chunklist_w2019900937.m3u8" type="application/x-mpegURL">

  </video>

  <script>
  </script>

</body>
</html>

it remain same, you have to click play to start the streaming, i just want to open page and it play load and play self


----------



## yesyesloud (Jun 1, 2018)

```
<video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268" data-setup='{}' autoplay="true">
```


----------



## chanfuterboy (Jun 1, 2018)

still no luck. see actually page how it does it http://awortinkos.com/test2.php


----------



## yesyesloud (Jun 1, 2018)

chanfuterboy said:


> still no luck. see actually page how it does it http://awortinkos.com/test2.php


Autoplaying here...


----------



## chanfuterboy (Jun 1, 2018)

i see in IE it works, but Chrome not i clear Cache also same... strange


----------



## kruk (Jun 1, 2018)

="true" is redundant. Autoplay is on when the attribute is present, and off when it's removed. You also can't turn it off by setting autoplay="false".

Chrome is "special": https://www.blog.google/products/chrome/improving-autoplay-chrome/
You can try and mute the video by adding "muted" attribute:


```
<video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="1920" height="1080" data-setup='{}' autoplay muted>
```


----------



## yesyesloud (Jun 1, 2018)

kruk said:


> ="true" is redundant. Autoplay is on when the attribute is present, and off when it's removed. You also can't turn it off by setting autoplay="false".


Sure is. I suggested _autoplay='true'_ just in case. Of course there's no need turn off a feature that's off by default.



chanfuterboy said:


> i see in IE it works, but Chrome not i clear Cache also same... strange


It always works with local html files though (browser-agnostic)... Interesting.


----------

