
Time Offset with Primary set as Flash
In my script I pull a start time from a MySQL table. This works only when the primary isn't set as Flash. However, I need the primary to be set a Flash because I need the HD button to show up by default. I need both of these features to exist. Parts of my code so far:
var isLogged = "<?php
if(!empty($login->getLogin())){ echo TRUE; }
else{ echo FALSE; }
?>";
var player = jwplayer("player-<?php echo $video->getBaseFileName(); ?>");
player.setup({
playlist: [{
image: "http://d9twdiekqysl5.cloudfront.net/<?php echo $video->getBaseFileName(); ?>/<?php echo $video->getBaseFileName(); ?>-00001.png",
sources: [{
file: "http://dep4zzgu32665.cloudfront.net/<?php echo $video->getBaseFileName(); ?>/<?php echo $video->getBaseFileName(); ?>.m3u8",
},{
file: "http://d3vd9hr1vidhzq.cloudfront.net/<?php echo $video->getBaseFileName(); ?>.mp4",
}],
tracks: [{
file: "https://leerburg.com/flix/vtt/test.vtt",
label: "English",
kind: "captions",
"default": false
}],
}],
width: "100%",
events: {
onPause: function(event) { if(isLogged) { updateFlixDuration(player.getPosition()); } },
onSeek: function(event) { if(isLogged) { updateFlixDuration(event.offset); } }
},
primary: "flash",
aspectratio:"16:9",
autostart:true,
skin: {
name: "glow",
active: "#E6E6E6",
inactive: "#000000",
background: "#474747"
},
logo: { hide: true }
});
var startTime = "<?php
$user = $login->getLogin();
if(!empty($user)){
$sql = "SELECT BookmarkTime FROM flix_bookmarks
WHERE Login = '$user' AND FlixID = '$flixID' AND BookmarkType = 'time'";
$result = mysql_query($sql) or die(mysql_error());
$num_rows = mysql_num_rows($result);
if($num_rows > 0) { while ($row = mysql_fetch_assoc($result)) { echo $row['BookmarkTime']; } }
else {
$sql1 = "INSERT INTO flix_bookmarks (Login, FlixID, BookmarkType, BookmarkName, BookmarkTime, BookmarkNotes)
VALUES ('$user', '$flixID', 'time', 'testing', '0', 'test')";
$result1 = mysql_query($sql1) or die(mysql_error());
echo '0';
}
} else {echo '0';}
?>";
// Player starts at the start time and creates a button that allows for 10 rewinds
player.on('ready', function(){
var controlbar = document.getElementsByClassName('jw-controlbar-left-group')[0];
var controlbarDiv = document.createElement('div');
controlbarDiv.setAttribute('onclick', 'var position = player.getPosition(); position -= 10; player.seek(position);');
controlbarDiv.setAttribute('class', 'jw-icon jw-icon-inline jw-button-color jw-reset');
controlbarDiv.setAttribute('id', 'rewind');
controlbar.insertBefore(controlbarDiv, controlbar.childNodes[0]);
player.seek(startTime); /*This part here is completely ignored */
});
When player.seek(startTime) is called, that part is ignored when primary is flash and plays the video from the start (0:00:00). I've checked startTime's value and it isn't 0 seconds. I need help figuring out how to do this resume functionality while the primary is flash or at the very least, add the HD button when the primary is HTML5