mirror of
https://github.com/seigler/HLS-over-IPFS-video-player
synced 2025-07-27 01:36:14 +00:00
6 lines
No EOL
4.2 KiB
HTML
6 lines
No EOL
4.2 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>HLS over IPFS video player</title><link rel="icon" href="favicon.e7ae9020.ico"><style>*{box-sizing:border-box}body,html{margin:0;padding:0}body{align-items:center;background-color:#000;color:#fff;display:flex;font-family:sans-serif;justify-content:center}code{white-space:nowrap}#status{bottom:100%;font-size:2em;height:3ex;left:0;margin-bottom:-3ex;position:fixed;text-align:center;transition:transform .3s ease 1s;width:100%}.is-hiding{transform:translateY(-3ex)}#video{display:none;height:100%;width:100%}#help{max-width:100%;padding:1em;width:80ch}pre{background-color:#ffffff1f;overflow:auto;padding:.5em}#contextMenu{background-color:#2f2f2faf;color:#fff;position:sticky;width:20em}#contextMenu>div{border:1px solid #0000007f;cursor:pointer;padding:.5em}#contextMenu>div+div{border-top:none}#contextBackground{bottom:0;height:100%;position:fixed;right:0;width:100%}.is-hidden{display:none}</style><script defer src="index.f7af227f.js"></script></head><body> <video id="video" controls controlslist="nodownload" autoplay></video> <div id="status"></div> <div class="is-hidden" id="contextBackground"> <div id="contextMenu"> <div id="contextMenu-url">Copy video URL</div> <div id="contextMenu-urlWithTime">Copy video URL at current time</div> </div> </div> <section id="help"> <h1>HLS over IPFS video player <a title="source code" href="https://github.com/seigler/HLS-over-IPFS-video-player/"><svg style="height:1em;width:1em" version="1.1" id="Layer_1" x="0" y="0" width="97" height="97" xml:space="preserve"><g><path fill="currentcolor" d="M92.71 44.408 52.591 4.291a5.918 5.918 0 0 0-8.369 0l-8.33 8.332L46.459 23.19a7.022 7.022 0 0 1 7.229 1.685 7.03 7.03 0 0 1 1.67 7.275l10.186 10.185a7.028 7.028 0 0 1 7.275 1.671 7.043 7.043 0 0 1-9.961 9.958 7.043 7.043 0 0 1-1.531-7.658l-9.5-9.499v24.997a7.042 7.042 0 1 1-8.096 11.291 7.042 7.042 0 0 1 2.307-11.496v-25.23a7.041 7.041 0 0 1-3.823-9.235L31.798 16.715 4.288 44.222a5.92 5.92 0 0 0 0 8.371l40.121 40.118a5.918 5.918 0 0 0 8.369 0L92.71 52.779a5.92 5.92 0 0 0 0-8.371z"/></g></svg></a></h1> <h2 id="how-to-use"> <a class="anchor" href="#how-to-use"></a>How to use: </h2> <p>Accepts three query parameters:</p> <ul> <li> <code>hash</code>: required. The IPFS hash of a folder containing an HLS playlist and its files. </li> <li> <code>source</code>: optional, defaults to <code>master.m3u8</code>. </li> <li> <code>title</code>: optional, allows overriding the browser tab title. </li> <li><code>time</code>: optional, start the video at this many seconds</li> </ul> <h2 id="usage-examples"> <a class="anchor" href="#usage-examples"></a>Usage Examples: </h2> <ul> <li> <a href="https://ipfsvideo.cc/?hash=QmdpAidwAsBGptFB3b6A9Pyi5coEbgjHrL3K2Qrsutmj9K&title=Big%20Buck%20Bunny">Big Buck Bunny</a> </li> <li> <a href="https://ipfsvideo.cc/?hash=QmYzdc44xBkVgp8aWJW57KprjDs5j2hmN8g7eDqm5pvY8L&title=What+is+the+Royal+Path%3F+-+Royal+Path+001">What is the Royal Path? - Royal Path 001</a> </li> </ul> <h2 id="how-to-make-compatible-videos"> <a class="anchor" href="#how-to-make-compatible-videos"></a>How to make compatible videos: </h2> <p> Here is a Bash script you can use to encode a video into a HLS folder with a playlist: </p> <pre>#!/usr/bin/env bash
|
|
outdir=${1%.*}
|
|
mkdir "$outdir"
|
|
pushd "$outdir"
|
|
ffmpeg -i "../$1" -profile:v baseline -level 3.0 -start_number 0 -hls_time 5 -hls_list_size 0 -f hls master.m3u8
|
|
popd</pre> <p> (If you add that to your path as <code>recode-to-hls</code> you can convert a folder of MP4 files with the command <code>ls *.mp4 -1 | xargs -d "\n" -n1 recode-to-hls</code>.) </p> <p> A folder produced this way can be posted to IPFS, and that hash is used in this page URL. Here are two hashes created following this format: </p> <ul> <li> <code>QmdpAidwAsBGptFB3b6A9Pyi5coEbgjHrL3K2Qrsutmj9K</code> - Big Buck Bunny </li> <li> <code>QmYzdc44xBkVgp8aWJW57KprjDs5j2hmN8g7eDqm5pvY8L</code> - Royal Path episode 001 </li> </ul> <noscript> <p> <strong>Since your browser is not executing JavaScript, none of this will work.</strong> </p> </noscript> </section> </body></html> |