Jump to content

Clappr Video Player, set Default Video?

QQ_cazo
	<div id="player"></div>
	<script>
		var player = new Clappr.Player({
			source: "<?= $_GET['m3u8'] ?>",
			parentId: "#player",
			plugins: [
				PlaybackRatePlugin,
				LevelSelector,
				ClapprPIPPlugin,
				HlsjsPlayback
			],
			levelSelectorConfig: {
				title: 'Quality',
				labels: {
        3: '',
				2: '', // 500kbps
				1: '', // 240kbps
				0: '', // 120kbps
			},
			labelCallback: function(playbackLevel, customLabel) {
					return customLabel + playbackLevel.level.height+'p'; // High 720p
				}
			},
			///HLS CONFIG
			hlsUseNextLevel: false,
			hlsMinimumDvrSize: 60,
			hlsRecoverAttempts: 16,
			hlsPlayback: {
				preload: false,
				customListeners: [],
			},
			playback: {
				extrapolatedWindowNumSegments: 2,
				triggerFatalErrorOnResourceDenied: false,
				hlsjsConfig: {
					maxBufferSize: 30,
					backBufferLength: 30,
					maxBufferLength: 15,
				},
			},
    });
    player.core.activePlayback.on(Clappr.Events.PLAYBACK_LEVELS_AVAILABLE, function(levels) {
      player.core.activePlayback.currentLevel = 3
    })
	</script>

the m3u8 file:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=1251328,RESOLUTION=426x240,NAME="240"
part_240p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1563648,RESOLUTION=640x360,NAME="360"
part_360p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2084864,RESOLUTION=1280x720,NAME="720"
part_720p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=3128320,RESOLUTION=1920x1080,NAME="1080"
part_1080p.m3u8

 

 

How can i make the Video player play the highest Video first, and res go down if the internet is slow?

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×