m3u8링크를 볼수있는 동영상 hls 게시판 스킨

· 2023-03-26 (일) 13:17:26 · 2745 · 6
img1.daumcdn.png

간단하게 만들어 보았습니다.

기존에 vimeo 플레이어게시판을 hls로 변형하였습니다.

 

wr_link1 에 sample 링크 

https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8

 

 

 

view.skin.php

 

[code]

<script src='https://d33wubrfki0l68.cloudfront.net/js/9012aa6cdcc02be8d7cbd62c6f12aff976c2d83b/dist/hls.js'></script>

[/code]

 

[code]

<script>
      var video = document.getElementById('video');      
      if (Hls.isSupported()) {
        var hls = new Hls({
          debug: true,
        });
        hls.loadSource("<?php echo $view['wr_link1'];?>");
        hls.attachMedia(video);
        hls.on(Hls.Events.MEDIA_ATTACHED, function () {
          video.muted = true;
          video.play();
        });
      }
      // hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.
      // When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element through the `src` property.
      // This is using the built-in support of the plain video element, without using hls.js.
      else if (video.canPlayType('application/vnd.apple.mpegurl')) {
        video.src = "<?php echo $view['wr_link1'];?>";
        video.addEventListener('canplay', function () {
          video.play();
        });
      }
    </script>

[/code]

 

[code]

영상위치

<video id="video" width='100%' height='auto' ></video>

[/code]

버전 정보

테스트한 버전 5.4
호환 가능 버전 5.3 이상

첨부파일

img1.daumcdn.png (10.2 KB)
0회 2023-03-26 13:17 포인트 차감 10
hls.zip (28.7 KB) 27회 2023-03-26 13:17 포인트 차감 10
hls.js (1.1 MB) 4회 2023-03-26 13:17 포인트 차감 10
|

댓글 6개

감사 합니다.
2023-03-27 (월) 09:57:52
감사합니다.
감사합니다.
감사합니다.
2023-04-04 (화) 01:07:25
감사합니다.
2023-04-08 (토) 06:02:20
데모 보는곳이 포인트 차감 부분으로 글 보기가 안됩니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 스킨

2,752건

좋은 댓글과 좋아요는 제작자에게 큰힘이 됩니다.

+