Added setting of trim times on page load.

pull/75/head
mg 5 years ago
parent 22a7c490b3
commit 950204aec6

@ -50,7 +50,6 @@
<!-- <div class="sectionContainer" style="display:none;">
<table>
<tr>
<th>Wubloader URL</th>
<th>Stream</th>
<th>Start Time</th>
<th>End Time</th>
@ -59,7 +58,6 @@
<th></th>
</tr>
<tr>
<td><input id="WubloaderLocation" value="http://charm.wubs.stream:20088" /></td>
<td><input id="StreamName" value="gamesdonequick" /></td>
<td><input id="StreamStart" value="2019-01-06T16:00:00" /></td>
<td><input id="StreamEnd" value="2019-01-06T17:00:00" /></td>
@ -68,9 +66,8 @@
<td><input type="button" value="Load Playlist" onclick="loadPlaylist()" /></td>
</tr>
<tr>
<td><a href="javascript:alert('https://wubloader.codegunner.com');">Wubloaders</a></td>
<td><a href="javascript:alert('seabats, lunarjade, gamesdonequick');">Streams</a></td>
<td><a href="javascript:window.open(document.getElementById('WubloaderLocation').value + '/files/' + document.getElementById('StreamName').value + '/source', '_blank');">Hours</a></td>
<td><a href="javascript:window.open('/files/' + document.getElementById('StreamName').value + '/source', '_blank');">Hours</a></td>
<td></td>
<td></td>
<td></td>
@ -81,6 +78,8 @@
<div class="sectionContainer">
<h1 style="color:#1976d2;font-size:34px;line-height:38px;">Wubloader Queue</h1>
<!-- Add in filters based on time period, category, and state -->
<!-- Throw in JQueryUI to run the filter menus, not worth re-inventing the wheel -->
<table id="QueueTable">
<tr>
<th>Start Time</th>

@ -27,7 +27,6 @@
<div style="max-width:1280px;margin:auto;padding-top:25px;">
<table id="wubloaderInputTable">
<tr>
<th>Wubloader URL</th>
<th>Stream</th>
<th>Start Time</th>
<th>End Time</th>
@ -36,7 +35,6 @@
<th></th>
</tr>
<tr>
<td><input id="WubloaderLocation" value="" disabled/></td>
<td><input id="StreamName" value="rpglimitbreak" /></td>
<td><input id="StreamStart" style="display:none;" class="UTCTimeInput" value="" /><input id="BusTimeStart" class="BusTimeInput" value="0:00" /></td>
<td><input id="StreamEnd" style="display:none;" class="UTCTimeInput" value="" /><input id="BusTimeEnd" class="BusTimeInput" value="1:00" /></td>
@ -45,9 +43,8 @@
<td><input type="button" value="Load Playlist" onclick="loadPlaylist()" /></td>
</tr>
<tr>
<td><a href="javascript:alert('https://wubloader.codegunner.com');">Wubloaders</a></td>
<td><a href="javascript:window.open(document.getElementById('WubloaderLocation').value + '/files');">Streams</a></td>
<td><a href="javascript:window.open(document.getElementById('WubloaderLocation').value + '/files/' + document.getElementById('StreamName').value + '/source', '_blank');">Hours</a></td>
<td><a href="javascript:window.open('/files');">Streams</a></td>
<td><a href="javascript:window.open('/files/' + document.getElementById('StreamName').value + '/source', '_blank');">Hours</a></td>
<td>
<input type="radio" id="BusTimeToggleUTC" name="BusTimeToggle" value="UTC" onclick="toggleTimeInput(this.value)"> UTC
<input type="radio" id="BusTimeToggleBus" name="BusTimeToggle" value="BUSTIME" onclick="toggleTimeInput(this.value)" checked="checked"> Bustime

@ -13,13 +13,15 @@ pageSetup = function() {
}
//data = testThrimShim;
document.getElementById("hiddenSubmissionID").value = data.id;
document.getElementById("StreamName").value = data.video_channel ? data.video_channel:document.getElementById("StreamName").value;
document.getElementById("StreamStart").value = data.event_start;
document.getElementById("BusTimeStart").value = (new Date(data.event_start+"Z") < desertBusStart ? "-":"") + videojs.formatTime(Math.abs((new Date(data.event_start+"Z") - desertBusStart)/1000), 600.01);
document.getElementById("StreamEnd").value = data.event_end;
document.getElementById("BusTimeEnd").value = (new Date(data.event_end+"Z") < desertBusStart ? "-":"") + videojs.formatTime(Math.abs((new Date(data.event_end+"Z") - desertBusStart)/1000), 600.01);
document.getElementById("VideoTitle").value = data.video_title;
document.getElementById("VideoDescription").value = data.video_description ? data.video_description:data.description;
loadPlaylist();
loadPlaylist(data.video_start, data.video_end);
});
}
else {
@ -33,8 +35,8 @@ pageSetup = function() {
}
};
loadPlaylist = function() {
var playlist = document.getElementById("WubloaderLocation").value + "/playlist/" + document.getElementById("StreamName").value + ".m3u8";
loadPlaylist = function(startTrim, endTrim) {
var playlist = "/playlist/" + document.getElementById("StreamName").value + ".m3u8";
if(document.getElementById("BusTimeToggleBus").checked) {
var streamStart = desertBusStart;
@ -53,11 +55,11 @@ loadPlaylist = function() {
var streamEnd = document.getElementById("StreamEnd").value ? "end="+document.getElementById("StreamEnd").value:null;
var queryString = (streamStart || streamEnd) ? "?" + [streamStart, streamEnd].filter((a) => !!a).join("&"):"";
setupPlayer(playlist + queryString);
setupPlayer(playlist + queryString, startTrim, endTrim);
//Get quality levels for advanced properties.
document.getElementById('qualityLevel').innerHTML = "";
fetch(document.getElementById('WubloaderLocation').value + '/files/' + document.getElementById('StreamName').value).then(data => data.json()).then(function (data) { // {mode: 'cors'} ???
fetch('/files/' + document.getElementById('StreamName').value).then(data => data.json()).then(function (data) { // {mode: 'cors'} ???
if (!data.length) {
console.log("Could not retrieve quality levels");
return;
@ -119,8 +121,7 @@ thrimbletrimmerDownload = function() {
var downloadStart = getRealTimeForPlayerTime(discontinuities, player.trimmingControls().options.startTrim);
var downloadEnd = getRealTimeForPlayerTime(discontinuities, player.trimmingControls().options.endTrim);
var targetURL = document.getElementById("WubloaderLocation").value +
"/cut/" + document.getElementById("StreamName").value +
var targetURL = "/cut/" + document.getElementById("StreamName").value +
"/"+document.getElementById('qualityLevel').options[document.getElementById('qualityLevel').options.selectedIndex].value+".ts" +
"?start=" + downloadStart +
"&end=" + downloadEnd +

@ -39,7 +39,10 @@ function setupPlayer(source, startTrim, endTrim) {
this.vhs.playlists.on('loadedmetadata', function() {
// setTimeout(function() { player.play(); }, 1000);
player.hasStarted(true); //So it displays all the controls.
var trimmingControls = player.trimmingControls({ startTrim:(startTrim ? startTrim:0), endTrim:(endTrim ? endTrim:player.duration()) });
stream_start = player.vhs.playlists.master.playlists.filter(playlist => typeof playlist.discontinuityStarts !== "undefined")[0].dateTimeObject;
startTrim = startTrim ? (new Date(startTrim+"Z")-stream_start)/1000:0;
endTrim = endTrim ? (new Date(endTrim+"Z")-stream_start)/1000:player.duration();
var trimmingControls = player.trimmingControls({ startTrim:startTrim, endTrim:endTrim });
});
// How about an event listener?

Loading…
Cancel
Save