Skip to content

Commit

Permalink
Updated JSDocs, fixed the no pause when supposed to pause bug, added …
Browse files Browse the repository at this point in the history
…auto scrolling (temp disable on mouse down on scroll), fixed expand/minimize bug, changed console.infos to console.logs
  • Loading branch information
crazoter committed Jul 19, 2019
1 parent 6221e57 commit 09170c3
Show file tree
Hide file tree
Showing 61 changed files with 1,596 additions and 300 deletions.
2 changes: 1 addition & 1 deletion Others/js/other/object_printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function printObject(object) {
}
}
}
console.info(output);
console.log(output);
}

printObject(Panopto);
4 changes: 4 additions & 0 deletions PanoptoPlus/dev/libs/triceam-megalist/megalist.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ window.requestAnimFrame = (function(){
onTouchStart: function ( event ) {
if (!this.animating ) {
this.animating = true;
this.$el.prop("animating", true);
this.render();
}

Expand Down Expand Up @@ -201,6 +202,7 @@ window.requestAnimFrame = (function(){

onTouchEnd: function ( event ) {
this.animating = false;
this.$el.prop("animating", false);
var id = this.$el.attr("id");

this.inputEndCoordinates = this.inputCoordinates;
Expand Down Expand Up @@ -628,6 +630,7 @@ window.requestAnimFrame = (function(){

scrollbarTouchStart: function( event ) {
this.cleanupEventHandlers();
this.$el.prop("scrolling", true);
this.scrollbarInputCoordinates = this.getInputCoordinates( event );

$(document).bind( this.TOUCH_MOVE, this.scrollbarMoveHandler );
Expand Down Expand Up @@ -688,6 +691,7 @@ window.requestAnimFrame = (function(){

scrollbarTouchEnd: function( event ) {
this.cleanupEventHandlers();
this.$el.prop("scrolling", false);
this.cleanupListItems();
event.preventDefault();
return false;
Expand Down
2 changes: 1 addition & 1 deletion PanoptoPlus/dev/libs/uupaa/mpeg2ts/MPEG2TS.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function _parseMPEG2PESPacket(subview) { // @arg Object - subview, MPEG2-TS Audi
// また http://linuxtv.org/pipermail/linux-dvb/2008-August/thread.html#27991 から始まるスレッドにも情報がある
if (videoStream && PES_packet_length === 0) {
if (MPEG2TS["VERBOSE"]) {
console.info("videoStream and PES_packet_length = 0");
console.log("videoStream and PES_packet_length = 0");
}
PES_packet_length = subview.source.length;
}
Expand Down
18 changes: 9 additions & 9 deletions PanoptoPlus/dev/libs/uupaa/mpeg2ts/MPEG2TSDemuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function _readTSPacketPayload(subview, // @arg Object - subview for rea
break;
case "VIDEO":
if (MPEG2TSDemuxer["VERBOSE"]) {
console.info("VIDEO PACKET. PID = 0x" + PID.toString(16),
console.log("VIDEO PACKET. PID = 0x" + PID.toString(16),
"PCR = " + PCR + "(" + (PCR / MPEG2_BASE_CLOCK) + " sec)");
}
_storeTSPacketPayload(subview, header, mpeg2ts["VIDEO_TS_PACKET"]);
Expand All @@ -275,7 +275,7 @@ function _readTSPacketPayload(subview, // @arg Object - subview for rea
break;
case "AUDIO":
if (MPEG2TSDemuxer["VERBOSE"]) {
console.info("AUDIO PACKET. PID = 0x" + PID.toString(16),
console.log("AUDIO PACKET. PID = 0x" + PID.toString(16),
"PCR = " + PCR + "(" + (PCR / MPEG2_BASE_CLOCK) + " sec)");
}
_storeTSPacketPayload(subview, header, mpeg2ts["AUDIO_TS_PACKET"]);
Expand All @@ -287,7 +287,7 @@ function _readTSPacketPayload(subview, // @arg Object - subview for rea
break;
case "USER":
if (MPEG2TSDemuxer["VERBOSE"]) {
console.info("USER DEFINED PID: 0x" + PID.toString(16));
console.log("USER DEFINED PID: 0x" + PID.toString(16));
}
break;
default:
Expand Down Expand Up @@ -474,14 +474,14 @@ function _readPAT(subview, // @arg Object - packet subview. { source, cursor }
if (NET_PID.indexOf(pid) < 0) { // avoid duplicate PID
NET_PID.push(pid);
if (MPEG2TSDemuxer["VERBOSE"]) {
console.info("collect NET_PID: 0x" + pid.toString(16));
console.log("collect NET_PID: 0x" + pid.toString(16));
}
}
} else {
if (PMT_PID.indexOf(pid) < 0) { // avoid duplicate PID
PMT_PID.push(pid);
if (MPEG2TSDemuxer["VERBOSE"]) {
console.info("collect PMT_ID: 0x" + pid.toString(16));
console.log("collect PMT_ID: 0x" + pid.toString(16));
}
}
}
Expand Down Expand Up @@ -642,7 +642,7 @@ function _readPMT(subview, // @arg Object - packet subview. { source, cursor }
if (MPEG2TSDemuxer["VERBOSE"]) {
console.log("add VIDEO_STREAM_PID", elementary_PID);
console.log("Found Video Stream. stream_type: 0x" + stream_type.toString(16));
console.info("Collect VIDEO_STREAM_PID: 0x" + elementary_PID.toString(16));
console.log("Collect VIDEO_STREAM_PID: 0x" + elementary_PID.toString(16));
}
break;
case TYPE_AUDIO:
Expand All @@ -651,15 +651,15 @@ function _readPMT(subview, // @arg Object - packet subview. { source, cursor }
if (MPEG2TSDemuxer["VERBOSE"]) {
console.log("add AUDIO_STREAM_PID", elementary_PID);
console.log("Found Audio Stream. stream_type: 0x" + stream_type.toString(16));
console.info("Collect AUDIO_STREAM_PID: 0x" + elementary_PID.toString(16));
console.log("Collect AUDIO_STREAM_PID: 0x" + elementary_PID.toString(16));
}
break;
case TYPE_META:
META_STREAM_PID = elementary_PID;
if (MPEG2TSDemuxer["VERBOSE"]) {
console.log("add META_STREAM_PID", elementary_PID);
console.log("Found Meta Stream. stream_type: 0x" + stream_type.toString(16));
console.info("Collect META_STREAM_PID: 0x" + elementary_PID.toString(16));
console.log("Collect META_STREAM_PID: 0x" + elementary_PID.toString(16));
}
break;
case TYPE_TEXT:
Expand Down Expand Up @@ -754,7 +754,7 @@ function _readDescriptor(desc_view) { // @arg Object - { source, cursor }
MPEG4_audio_extension_descriptor(desc_data_view);
break;
default:
console.info("UNKNOWN DESCRIPTOR_TAG", descriptor_tag);
console.log("UNKNOWN DESCRIPTOR_TAG", descriptor_tag);
}
*/
return {
Expand Down
9 changes: 9 additions & 0 deletions PanoptoPlus/dev/panopto/css/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,13 @@

.viewer #viewerHeader div.header-right {
float: none;
}

.viewer #viewerContent #leftPane #eventTabs #eventTabControl div.event-tab-header {
padding: 0;
}

.viewer #viewerContent #leftPane #eventTabs #eventTabControl div.event-tab-header span {
display: block;
padding: 4px 0px 3px 14px;
}
7 changes: 1 addition & 6 deletions PanoptoPlus/dev/panopto/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,9 @@
silenceCueManager: new SilenceCueManager(settings),
tsTracker: new TSTracker(settings),
carouselManager: new CarouselManager(settings),
//loggerDisabler: new LoggerDisabler(settings),
loggerDisabler: new LoggerDisabler(settings),
delayDisabler: new DelayDisabler(settings)
};
/*
let keys = Object.keys(App);
keys.forEach((key) => {
App[key].init();
});*/

//Initialize initial settings
console.log("FIN");
Expand Down
14 changes: 7 additions & 7 deletions PanoptoPlus/dev/panopto/js/jsmpeg/ts-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ TSTracker = (() => {
switch (event.data.msgEnum) {
case MessageEnums.NORMAL_RESULTS:
//debugger;
//console.info("TSTracker NORMAL RES:", event.data);
//console.log("TSTracker NORMAL RES:", event.data);
//After merging, the start times are at their approprate locations
this.insertSilentSections(event.data.options.id, event.data.data.results);
break;
case MessageEnums.RAW_DATA_RESULTS:
//console.info(event.data.data);
//console.log(event.data.data);
this.logDataForR(startTime, event.data.data);
break;
case MessageEnums.NOISE_RESULTS:
console.info("TSTracker NOISE RES: ", event.data.data);
console.log("TSTracker NOISE RES: ", event.data.data);
if (!event.data.data || !event.data.data.results) throw new Error("Invalid noise reference line features");
this.noiseReferenceLineFeatures = event.data.data.results;
this.noiseReferenceCallbacks.fire();
Expand Down Expand Up @@ -223,7 +223,7 @@ TSTracker = (() => {
}
loop();

console.info("TS-Tracker initialized");
console.log("TS-Tracker initialized");
};
//#endregion

Expand All @@ -244,7 +244,7 @@ TSTracker = (() => {
};*/

//return;
//console.info('TsTrackingEvent', event.detail.data, event.detail.options);
//console.log('TsTrackingEvent', event.detail.data, event.detail.options);
self.process(event.detail.data, {
isNoiseSample: event.detail.options.isNoiseSample,
startProcessingFrom: event.detail.options.startProcessingFrom,
Expand Down Expand Up @@ -294,7 +294,7 @@ TSTracker = (() => {
* @returns {undefined}
*/
decodeAudioData(audioByteStream, options) {
//console.info(audioByteStream);
//console.log(audioByteStream);
//https://stackoverflow.com/questions/8074152/is-there-a-way-to-use-the-web-audio-api-to-sample-audio-faster-than-real-time
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
audioCtx.decodeAudioData(Uint8ArrayToArrayBuffer(audioByteStream),
Expand All @@ -303,7 +303,7 @@ TSTracker = (() => {
options.duration = audioBuffer.duration;
options.float32Length = audioBuffer.length;
options.silenceThreshold = Settings.getDataAsObject()[Settings.keys.silencethreshold];
//console.info(options.silenceThreshold);
//console.log(options.silenceThreshold);
//Convert to ArrayBuffers for transfer
const channel0 = audioBuffer.getChannelData(0).buffer;
const channel1 = audioBuffer.getChannelData(1).buffer;
Expand Down
32 changes: 21 additions & 11 deletions PanoptoPlus/dev/panopto/js/ui/delay-disabler.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,34 @@ DelayDisabler = (() => {

let firedToggle = false;
//I hate this method, but it's our hack in the bag
//Temporarily disable delay on click or on spacebar
//Temporarily disable delay on click (play btn or video) or on spacebar
let tmpDisable = () => {
console.info("Tmp disable");
console.log("Tmp disable");
firedToggle = true;
window.setTimeout(() => {firedToggle = false}, 10);
window.setTimeout(() => {
firedToggle = false;
//If paused
if ($("#playButton.paused").length == 1) {
//Pause all players; this resolves the issue but doesn't seem to resolve the root cause
for (let i = 0; i <= 1; i++) {
let tmp = flowplayer(i);
if (tmp && tmp.playing)
tmp.pause();
}
}
}, 10);
}
$(window).keypress((e) => {
$(document).keypress((e) => {
if (e.which === 32) {
tmpDisable();
}
});
$("#playButton").click((e) => {
tmpDisable();
});
$("#playButton").click((e) => { tmpDisable(); });
$(".fp-ui").click((e) => { tmpDisable(); });

let videoDOMs = undefined;
let repeatableFunction = () => {
//console.info('rF', firedToggle, Panopto.Viewer.Viewer.playState(), videoDOMs, videoDOMs[0].paused, videoDOMs[1].paused);
//console.log('rF', firedToggle, Panopto.Viewer.Viewer.playState(), videoDOMs, videoDOMs[0].paused, videoDOMs[1].paused);
if (!firedToggle && Panopto.Viewer.Viewer.playState() === 1 && videoDOMs.some((video) => video.paused)) {
//Supposed to be playing but video is paused?!
//lol...
Expand All @@ -49,7 +59,7 @@ DelayDisabler = (() => {
if (video) { video.play(); }
});
Panopto.Viewer.Viewer.setPlayState(1);
console.info("Delay quickfix triggered");
console.log("Delay quickfix triggered");
window.setTimeout(function() {
firedToggle = false;
repeatableFunction();
Expand All @@ -58,7 +68,7 @@ DelayDisabler = (() => {
};

Panopto.Core.Logger.log = ((msg) => {
console.info(msg);
console.log("Logger.log", msg);
//Secondary player started playing stream null: Stream stopped
if (msg.indexOf("player changed play state to {1}") > -1 || msg.indexOf("player changed play state to 2") > -1) {
//playstate: 1: playing (or at least supposed to be), 2: paused
Expand All @@ -70,7 +80,7 @@ DelayDisabler = (() => {
}, 1);
}
});
console.info("Delay disabler initialized");
console.log("Delay disabler initialized");
};
let ctxBridge = new ContextBridge(injectedFunc);
ctxBridge.exec();
Expand Down
2 changes: 1 addition & 1 deletion PanoptoPlus/dev/panopto/js/ui/settings-page-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let SettingsPage = (() => {
this.saveSettingsWithoutCaching();
App.transcriptDisplay.updateVisibility();
}
console.info(event);
console.log(event);
}

saveSettingsWithoutCaching() {
Expand Down
2 changes: 1 addition & 1 deletion PanoptoPlus/dev/panopto/js/ui/settings-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let SettingsPage = (() => {
App.transcriptDisplay.updateVisibility();
}

console.info(event);
console.log(event);
}

saveSettingsWithoutCaching() {
Expand Down
38 changes: 23 additions & 15 deletions PanoptoPlus/dev/panopto/js/ui/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ let Sidebar = (() => {
* @param {Object} settings settings object
*/
constructor(settings) {
this.mainVideoIndex = 0;
this.init();
VideosLoadedEvent.subscribe(() => {
this.mainVideoIndex = 0;
this.init();
});
}

/**
Expand Down Expand Up @@ -63,11 +65,11 @@ let Sidebar = (() => {
});

//Add icons
$("#commentsTabHeader").prepend('<i class="far fa-comments"></i>');
$("#notesTabHeader").prepend('<i class="far fa-sticky-note"></i>');
$("#bookmarksTabHeader").prepend('<i class="far fa-bookmark"></i>');
//$("#commentsTabHeader").prepend('<i class="far fa-comments"></i>');
//$("#notesTabHeader").prepend('<i class="far fa-sticky-note"></i>');
//$("#bookmarksTabHeader").prepend('<i class="far fa-bookmark"></i>');
$("#hideEventsButton div").text("Hide Sidebar");
$("#hideEventsButton div").prepend('<i class="fas fa-chevron-left" style="padding-right:4px"></i>');
//$("#hideEventsButton div").prepend('<i class="fas fa-chevron-left" style="padding-right:4px"></i>');
$("#hideEventsButton").css({display: "initial", visibility: "visible"});

//Hide button
Expand All @@ -81,18 +83,24 @@ let Sidebar = (() => {
});

//Show button
//BUG: SOMETIMES THE EVENT DOESN'T FIRE IF CLICKING THE TABS BELOW SCREEN. LOW PRIORITY.
$("#sidebar-tabs .tabs-container .show-btn").click(() => {
$("#commentsTabHeader").click();
});
$("#commentsTabHeader").click(this.expand);
$("#commentsTabHeader span").click(this.expand);
$("#notesTabHeader").click(this.expand);
$("#notesTabHeader span").click(this.expand);
$("#bookmarksTabHeader").click(this.expand);
$("#bookmarksTabHeader span").click(this.expand);
$(".event-tab-header").click(this.expand);
$("#searchInput").click(this.expand);

//Inject code to trigger our own expand mechanism on top of the default
let injectedFunc = () => {
Panopto.Viewer.Viewer.expandLeftPaneFx = Panopto.Viewer.Viewer.expandLeftPane;
Panopto.Viewer.Viewer.expandLeftPane = () => {
//expand function
$("#sidebar-tabs").removeClass("compact");
$("#sidebar-tabs .tabs-container .show-btn").hide();
$("#sidebar-tabs .tabs-container .hide-btn").show();
//original implementation
Panopto.Viewer.Viewer.expandLeftPaneFx();
};
};
let ctxBridge = new ContextBridge(injectedFunc);
ctxBridge.exec();

//Panopto literally switches the positions of the screens, so if the user toggles screens make sure it's on the right tab
//Making it such that it stays on the same tab is a KIV
Expand Down
8 changes: 4 additions & 4 deletions PanoptoPlus/dev/panopto/js/ui/silence-cue-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ let SilenceCueManager = (() => {
if (!Panopto.Viewer.Viewer.activeSecondary() || lastSynced < DESYNC_LIMIT || offset < FAST_JUMP_THRESHOLD) {
for (let i = 0; i < videoDOMs.length; i++) {
if (videoDOMs[i]) {
//console.info(`${videoDOMs[i].currentTime}`);
//console.log(`${videoDOMs[i].currentTime}`);
videoDOMs[i].currentTime += offset;
}
}
Expand All @@ -88,12 +88,12 @@ let SilenceCueManager = (() => {
prevTime = cues[0].endTime;
Panopto.Viewer.Viewer.position(cues[0].endTime);
lastSynced = 0;
console.info("Synced using Panopto API");
//console.log("Synced using Panopto API");
}
elapsedTime = (Date.now() - startTime) / 1000;
timeWatched = elapsedTime - timeSaved;
console.info(`Jump made from ${cues[0].startTime} to ${cues[0].endTime}, reduced by: ${cues[0].endTime - cues[0].startTime}`, `sync time: ${lastSynced}`);
//console.info(`Time saved: ${timeSaved.toFixed(4)}`, `elapsed: ${elapsedTime}`, `multipler: ${(elapsedTime / timeWatched).toFixed(2)}x`);//,`${videoDOMs[0].currentTime}`);
//console.log(`Jump made from ${cues[0].startTime} to ${cues[0].endTime}, reduced by: ${cues[0].endTime - cues[0].startTime}`, `sync time: ${lastSynced}`);
//console.log(`Time saved: ${timeSaved.toFixed(4)}`, `elapsed: ${elapsedTime}`, `multipler: ${(elapsedTime / timeWatched).toFixed(2)}x`);//,`${videoDOMs[0].currentTime}`);

}
};
Expand Down
Loading

0 comments on commit 09170c3

Please sign in to comment.