Skip to content

Instantly share code, notes, and snippets.

@RidleyLycan
Created September 12, 2017 00:54
Show Gist options
  • Save RidleyLycan/0fffcc9d3cf0159f90fa06ea47ace92a to your computer and use it in GitHub Desktop.
Save RidleyLycan/0fffcc9d3cf0159f90fa06ea47ace92a to your computer and use it in GitHub Desktop.
<html>
<head>
<!-- local files
<script type="text/javascript" src="node_modules/clappr/dist/clappr.js"></script>
<script type="text/javascript" src="dist/rtmp.js"></script>
-->
<script src="https://cdn.jsdelivr.net/gh/clappr/clappr@latest/dist/clappr.min.js"></script>
<script src="http://cdn.jsdelivr.net/clappr.rtmp/latest/rtmp.min.js"></script>
</head>
<body>
<div id="live-wrapper" ></div>
<script>
var liveSource = 'rtmp://146.185.61.140:1935/live/myStream'; // source found on http://www.vlc.eu.pn
var livePlayer = new Clappr.Player({
source: liveSource, parentId: "#live-wrapper",
plugins: {'playback': [RTMP]},
rtmpConfig: {
//swfPath: 'dist/assets/RTMP.swf',
playbackType: 'live'
},
});
</script>
<button type="button" onClick="livePlayer.play()">livePlayer.play</button> <!-- .play() does not work if video is paused/stopped/disconnected unless one use .load() the source again -->
<button type="button" onClick="livePlayer.pause()">livePlayer.pause</button>
<button type="button" onClick="livePlayer.stop()">livePlayer.stop</button>
<button type="button" onClick="livePlayer.load(liveSource)">load liveSource</button>
<br/><br/><br/>
<div id="vod-wrapper" ></div>
<script>
var vodSource = 'rtmp://184.72.239.149/vod/mp4:bigbuckbunny_1500.mp4'; // found on wowza forums:
var vodPlayer = new Clappr.Player({
source: vodSource, parentId: "#vod-wrapper",
plugins: {'playback': [RTMP]},
rtmpConfig: {
//swfPath: 'dist/assets/RTMP.swf',
playbackType: 'vod'
},
});
</script>
<button type="button" onClick="vodPlayer.play()">vodPlayer.play</button>
<button type="button" onClick="vodPlayer.pause()">vodPlayer.pause</button>
<button type="button" onClick="vodPlayer.stop()">vodPlayer.stop</button>
<button type="button" onClick="vodPlayer.load(vodSource)">load vodSource</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment