• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

need help with html code embed

chanfuterboy

New Member
Joined
Jun 1, 2018
Messages
4 (0.00/day)
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
 
Joined
Dec 6, 2016
Messages
748 (0.28/day)
Add autoplay attribute to your video element:

HTML:
<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):

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

chanfuterboy

New Member
Joined
Jun 1, 2018
Messages
4 (0.00/day)
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
 
Joined
Sep 11, 2013
Messages
182 (0.05/day)
System Name midnight toker
Processor i7 Skylake QHQF (6700K ES) @ 4.2GHz
Motherboard ASRock Z170 Pro4S
Cooling Corsair H100i
Memory 16GB (2x8GB) Samsung DDR4 @ 3200MHz
Video Card(s) Gigabyte Geforce Gtx 1080 Ti Gaming OC @ 2080MHz
Storage 128GB SSD, 75GB & 2TB HDDs
Display(s) Acer Predator XB1 XB271HU 27" 1440p 144Hz G-SYNC Monitor
Case Cooler Master MB511
Audio Device(s) Philips SHP2000 headphones
Power Supply EVGA SuperNOVA 1300W G2
Mouse Microsoft Wireless Desktop 3050
Keyboard same
Software Arch Linux, Windows 10 Pro 64-Bit
Code:
<video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268" data-setup='{}' autoplay="true">
 
Joined
Sep 11, 2013
Messages
182 (0.05/day)
System Name midnight toker
Processor i7 Skylake QHQF (6700K ES) @ 4.2GHz
Motherboard ASRock Z170 Pro4S
Cooling Corsair H100i
Memory 16GB (2x8GB) Samsung DDR4 @ 3200MHz
Video Card(s) Gigabyte Geforce Gtx 1080 Ti Gaming OC @ 2080MHz
Storage 128GB SSD, 75GB & 2TB HDDs
Display(s) Acer Predator XB1 XB271HU 27" 1440p 144Hz G-SYNC Monitor
Case Cooler Master MB511
Audio Device(s) Philips SHP2000 headphones
Power Supply EVGA SuperNOVA 1300W G2
Mouse Microsoft Wireless Desktop 3050
Keyboard same
Software Arch Linux, Windows 10 Pro 64-Bit
Joined
Dec 6, 2016
Messages
748 (0.28/day)
="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:

HTML:
  <video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="1920" height="1080" data-setup='{}' autoplay muted>
 
Joined
Sep 11, 2013
Messages
182 (0.05/day)
System Name midnight toker
Processor i7 Skylake QHQF (6700K ES) @ 4.2GHz
Motherboard ASRock Z170 Pro4S
Cooling Corsair H100i
Memory 16GB (2x8GB) Samsung DDR4 @ 3200MHz
Video Card(s) Gigabyte Geforce Gtx 1080 Ti Gaming OC @ 2080MHz
Storage 128GB SSD, 75GB & 2TB HDDs
Display(s) Acer Predator XB1 XB271HU 27" 1440p 144Hz G-SYNC Monitor
Case Cooler Master MB511
Audio Device(s) Philips SHP2000 headphones
Power Supply EVGA SuperNOVA 1300W G2
Mouse Microsoft Wireless Desktop 3050
Keyboard same
Software Arch Linux, Windows 10 Pro 64-Bit
="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.

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.
 
Top