Skip to content

Instantly share code, notes, and snippets.

@stmps
Last active February 10, 2019 19:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stmps/78ebb0b3d8979b333b0b to your computer and use it in GitHub Desktop.
Save stmps/78ebb0b3d8979b333b0b to your computer and use it in GitHub Desktop.
example jwplayer HTML for live playback of an RTMP stream
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
</head>
<body style="margin:0;padding:0">
<div id="player">Loading the player...</div>
<script type="text/javascript">
var aURL = window.location.href;
var streamkey = 'spelunky';
if (aURL.indexOf('?') != -1) {
streamkey = aURL.slice(aURL.indexOf('?') + 1);
}
jwplayer("player").setup({
file: "rtmp://stream.tgs.id.au/livestream/flv:" + streamkey,
image: "/spelunky.gif",
width: "100%",
aspectratio: "16:9",
title: "stream.tgs.id.au",
rtmp: { bufferlength: 0.2 },
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment