直播影片 - HTML video, Video.JS , hls(附檔名 .m3u8)的範例

使用 <video> 來播放 mp4影片、或是直播影片(在此以 HLS , hls為例。附檔名 .m3u8)

資料來源  https://juejin.cn/post/6903533860907302925  特別感謝

可運作的 範例一

<!doctype html>
<html lang="en" data-bs-theme="auto">
<head>
      <link href="https://vjs.zencdn.net/8.10.0/video-js.css" rel="stylesheet" />

      <!-- If you'd like to support IE8 (for Video.js versions prior to v7) -->
      <script src="https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>

     <script>
	videojs("my-video", {// 这里的 my-video 是 video 标签的 id
	  with: 1000,height: 800,//我指定了高宽度了
	  html5: {
	       hls: {
	         withCredentials: true,
	       },
	  },
	});
     </script>

</head>
<body>

  <video id="my-video" class="video-js" controls
    preload="auto"
    width="640"  height="264"
    poster="影片的標題圖檔.jpg"
    data-setup="{}">
  	
   <!-- 把地址换成自己的 MP4檔案
    <source src="MY_VIDEO.mp4" type="video/mp4" />  -->

  <!-- 直播(影片的測試網址) -->
 <source
     src="https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8"
     type="application/x-mpegURL">

    <p class="vjs-no-js">
         To view this video please enable JavaScript, and consider upgrading to a   web browser that
         <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
    </p>
  </video>

 <script src="https://vjs.zencdn.net/8.10.0/video.min.js"></script> 

<br />
資料來源:https://juejin.cn/post/6903533860907302925  <br />
实时直播测试地址rtmp,hls  https://www.jianshu.com/p/20f9e9bb89aa
  </body>
</html>

 

可運作的 範例二

  從 Video .JS 原廠說明的範例修改, https://videojs.com/getting-started/

  但如果沒有搭配 範例一 的  <video>寫法,只憑原廠說明的寫法,則無法運作。

  關於 <video>的使用說明,請參閱 https://www.letswrite.tw/video-js-player/

<!doctype html>
<html lang="en" data-bs-theme="auto">
<head>
     <link href="https://vjs.zencdn.net/8.10.0/video-js.css" rel="stylesheet" />

     <!-- If you'd like to support IE8 (for Video.js versions prior to v7) -->
     <!-- <script src="https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script> -->

</head>
<body>

  <video id="my-video" class="video-js" controls
    preload="auto"
    width="640"  height="264"
    poster="影片的標題圖檔.jpg"
    data-setup="{}">
  <source
     src="https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8"
     type="application/x-mpegURL">

</video>

<!--  可運作 -->
<!--
  <video id="my-video" class="video-js" controls
    preload="auto"
    width="640"  height="264"
    poster="影片的標題圖檔.jpg"
    data-setup="{}">
</video>

<script>
      var player = videojs('my-video');
 
	player.src({
	     src: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',
	     type: 'application/x-mpegURL',
	     withCredentials: true
	});
</script> 
-->


   <script src="https://vjs.zencdn.net/8.10.0/video.min.js"></script>

  </body>
</html>

 

關於HLS , hls直播格式的說明,請參閱  https://ithelp.ithome.com.tw/articles/10203792

 

 

 

我將思想傳授他人, 他人之所得,亦無損於我之所有;

猶如一人以我的燭火點燭,光亮與他同在,我卻不因此身處黑暗。----Thomas Jefferson

線上課程教學,遠距教學 (Web Form 約 51hr)  https://dotblogs.com.tw/mis2000lab/2016/02/01/aspnet_online_learning_distance_education_VS2015

線上課程教學,遠距教學 (ASP.NET MVC 約 135hr)  https://dotblogs.com.tw/mis2000lab/2018/08/14/ASPnet_MVC_Online_Learning_MIS2000Lab

 

寫信給我,不要私訊 --  mis2000lab (at) yahoo.com.tw  或  school (at) mis2000lab.net

 (1) 第一天 ASP.NET MVC5 完整影片(5.5小時 / .NET 4.x版)免費試聽。影片 https://youtu.be/9spaHik87-A 

 (2) 第一天 ASP.NET Core MVC 完整影片(3小時 / .NET Core 6.0~8.0)免費試聽。影片 https://youtu.be/TSmwpT-Bx4I 

[學員感言] mis2000lab課程評價 - ASP.NET MVC , WebForm  。 https://mis2000lab.medium.com/%E5%AD%B8%E5%93%A1%E6%84%9F%E8%A8%80-mis2000lab%E8%AA%B2%E7%A8%8B%E8%A9%95%E5%83%B9-asp-net-mvc-webform-77903ce9680b  


ASP.NET遠距教學、線上課程(Web Form + MVC)。 第一天課程, "完整" 試聽。 

.........   facebook社團   https://www.facebook.com/mis2000lab   ......................

.........  YouTube (ASP.NET) 線上教學影片  https://www.youtube.com/channel/UC6IPPf6tvsNG8zX3u1LddvA/

 

Blog文章 "附的範例" 無法下載,請看 https://dotblogs.com.tw/mis2000lab/2016/03/14/2008_2015_mis2000lab_sample_download

請看我們的「售後服務」範圍(嚴格認定)。

...................................................................................................................................................... 

ASP.NET MVC  => .NET Core MVC 線上教學  ...... 第一天課程 完整內容 "免費"讓您評估 / 試聽

[遠距教學、教學影片] ASP.NET (Web Form) 課程 上線了!MIS2000Lab.主講   事先錄好的影片,並非上課側錄!   觀看時,有如「一對一」面對面講課