From 5bbe9b40e7406e1313086381fad9b9012fb3ac8d Mon Sep 17 00:00:00 2001 From: digital-gnome <31593470+digital-gnome@users.noreply.github.com> Date: Tue, 3 Oct 2017 19:26:48 -0400 Subject: [PATCH 1/4] renderAlarmCues function Generates the html for alarmcues and passes it to JS var --- web/skins/classic/views/js/event.js.php | 77 +++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/web/skins/classic/views/js/event.js.php b/web/skins/classic/views/js/event.js.php index f4a14f1fe..e18ab44c9 100644 --- a/web/skins/classic/views/js/event.js.php +++ b/web/skins/classic/views/js/event.js.php @@ -47,3 +47,80 @@ var canStreamNative = ; // var deleteString = ""; var causeString = ""; + +// +// AlarmCues +// +Width(), $scale); + $lastFrame = end($frames); + $lastTime = $lastFrame['Delta'] * 100; + $ratio = $width / $lastTime; + $minAlarm = ceil(1 / $ratio); + $spanTimeStart = 0; + $spanTimeEnd = 0; + $alarmed = 0; + $alarmHtml = ""; + $pixSkewNone = 0; + $pixSkewAlarm = 0; + $skip = 0; + foreach ($frames as $key => $frame) { + if ($frame['Type'] == "Alarm" && $alarmed == 0) { //From nothing to alarm. End nothing and start alarm. + if ($skip > $key) continue; + $alarmed = 1; + if ($frame['Delta'] == 0) continue; //If event starts with alarm + $spanTimeEnd = $frame['Delta'] * 100; + $spanTime = $spanTimeEnd - $spanTimeStart; + $pix = $ratio * $spanTime; + $pixSkewNone += $pix - round($pix); + $pix = round($pix); + if (($pixSkewNone > 1 || $pixSkewNone < -1) && $pix + round($pixSkewNone) > 0) { //add skew if it's a pixel and won't zero span + $pix += round($pixSkewNone); + $pixSkewNone = $pixSkewNone - round($pixSkewNone); + } + $alarmHtml .= ""; + $spanTimeStart = $spanTimeEnd; + } elseif ($frame['Type'] !== "Alarm" && $alarmed == 1) { //from Alarm to nothing. End alarm and start nothing. + if ($skip > $key) continue; + $futNone = 0; + $keyPlus = $key + 1; + while ($futNone < $minAlarm) { //check ahead to see if there's enough for a none. + if (!array_key_exists($keyPlus, $frames )) break; //check if end of event + $futNone = ($frames[$keyPlus]['Delta'] * 100) - ($frame['Delta'] * 100); + if ($frames[$keyPlus]['Type'] == "Alarm") { + $skip = $keyPlus; + continue 2; + } + $keyPlus +=1; + } + if ((($frame['Delta'] * 100) - $spanTimeStart) < $minAlarm && (array_key_exists($keyPlus, $frames))) continue; //alarm short and more event + $spanTimeEnd = $frame['Delta'] * 100; + $spanTime = $spanTimeEnd - $spanTimeStart; + $alarmed = 0; + $pix = $ratio * $spanTime; + $pixSkewAlarm += $pix - round($pix); + $pix = round($pix); + if (($pixSkewAlarm > 1 || $pixSkewAlarm < -1) && $pix + round($pixSkewAlarm) > 0) { + $pix += round($pixSkewAlarm); + $pixSkewAlarm = $pixSkewAlarm - round($pixSkewAlarm); + } + $alarmHtml .= ""; + $spanTimeStart = $spanTimeEnd; + } elseif ($frame['Type'] == "Alarm" && $alarmed == 1 && !array_key_exists($key+1, $frames)) { // event ends on alarm + $spanTimeEnd = $frame['Delta'] * 100; + $spanTime = $spanTimeEnd - $spanTimeStart; + $alarmed = 0; + $pix = round($ratio * $spanTime); + $alarmHtml .= ""; + } + } + echo $alarmHtml; + } +} +?> +var alarmHtml = ''; From ea4b9486aafbeff970f3dceb72071e48f741e9c3 Mon Sep 17 00:00:00 2001 From: digital-gnome <31593470+digital-gnome@users.noreply.github.com> Date: Tue, 3 Oct 2017 19:28:06 -0400 Subject: [PATCH 2/4] alarmCues CSS also function.php to load new vjs override file --- web/skins/classic/css/classic/views/event.css | 21 +++++++ web/skins/classic/css/dark/views/event.css | 25 +++++++++ web/skins/classic/css/flat/views/event.css | 19 ++++++- web/skins/classic/includes/functions.php | 1 + web/skins/classic/js/video-js-skin.css | 56 +++++++++++++++++++ 5 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 web/skins/classic/js/video-js-skin.css diff --git a/web/skins/classic/css/classic/views/event.css b/web/skins/classic/css/classic/views/event.css index e80710772..4d096a665 100644 --- a/web/skins/classic/css/classic/views/event.css +++ b/web/skins/classic/css/classic/views/event.css @@ -1,3 +1,20 @@ +.alarmCue { + background-color: #222222; + height: 1.5em; + text-align: left; + margin: 0 auto 0 auto; +} + +.alarmCue span { + background-color:red; + height: 1.5em; + display: inline-block; +} + +span.noneCue { + background: none; +} + #dataBar { width: 100%; margin: 2px auto; @@ -13,6 +30,10 @@ padding: 2px; } +#eventVideo { + display: inline-block; +} + #menuBar1 { width: 100%; padding: 3px 0; diff --git a/web/skins/classic/css/dark/views/event.css b/web/skins/classic/css/dark/views/event.css index 13ac0cc0b..02209d528 100644 --- a/web/skins/classic/css/dark/views/event.css +++ b/web/skins/classic/css/dark/views/event.css @@ -1,3 +1,24 @@ +.alarmCue { + background-color: #222222; + height: 1.5em; + text-align: left; + margin: 0 auto 0 auto; +} + +.alarmCue span { + background-color:red; + height: 1.5em; + display: inline-block; +} + +span.noneCue { + background: none; +} + +#eventVideo { + display: inline-block; +} + #dataBar { width: 100%; margin: 2px auto; @@ -233,6 +254,10 @@ background: #dddddd; } +#eventVideo { +display: inline-block; +} + #thumbsKnob { width: 8px; height: 10px; diff --git a/web/skins/classic/css/flat/views/event.css b/web/skins/classic/css/flat/views/event.css index a41c56a38..3d03f199c 100644 --- a/web/skins/classic/css/flat/views/event.css +++ b/web/skins/classic/css/flat/views/event.css @@ -1,3 +1,20 @@ +.alarmCue { + background-color: #222222; + height: 1.5em; + text-align: left; + margin: 0 auto 0 auto; +} + +.alarmCue span { + background-color:red; + height: 1.5em; + display: inline-block; +} + +span.noneCue { + background: none; +} + #dataBar { width: 100%; margin: 2px auto; @@ -254,7 +271,7 @@ background-color: #444444; } #eventVideo { - position: relative; + display: inline-block; } #video-controls { diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 67e5c645c..854b36401 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -94,6 +94,7 @@ function xhtmlHeaders( $file, $title ) { } else if ( $title == 'Event' ) { ?> + diff --git a/web/skins/classic/js/video-js-skin.css b/web/skins/classic/js/video-js-skin.css new file mode 100644 index 000000000..447c22c44 --- /dev/null +++ b/web/skins/classic/js/video-js-skin.css @@ -0,0 +1,56 @@ +.vjs-tt-cue { + margin-bottom: .75em; +} + +.vjs-menu { + z-index: 5; +} + +.vjs-default-skin .vjs-playback-rate.vjs-menu-button .vjs-menu .vjs-menu-content { + width: 5em; +} + +.vjs-default-skin.vjs-user-inactive:hover .vjs-progress-control { + font-size: .3em; +} + +.vjs-default-skin.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar.vjs-zm { + visibility: visible; + opacity: 1; + bottom: -2em; + -webkit-transition: all .2s; + -moz-transition: all .2s; + -o-transition: all .2s; + transition: all .2s +} + +.vjs-default-skin.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control, +.vjs-default-skin.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-time-divider { + display: none; +} + +.vjs-default-skin .vjs-progress-holder .vjs-play-progress, .vjs-default-skin .vjs-progress-holder .vjs-load-progress { + height: 1em; +} + +.vjs-progress-holder.vjs-slider { + background-color: transparent; + z-index: 1; +} + +.vjs-progress-control.vjs-control { + background-color: rgba(7, 20, 30, 0.8); + height: 1.3em; + top: -1.3em; + display: block !important; +} + +.vjs-control div.alarmCue { + position: relative; + top: -1.3em; + background: none; +} + +.vjs-control .alarmCue { + height: 1.3em; +} From 398600d5f20ba262b10242489db6d267950f5bd4 Mon Sep 17 00:00:00 2001 From: digital-gnome <31593470+digital-gnome@users.noreply.github.com> Date: Tue, 3 Oct 2017 19:28:28 -0400 Subject: [PATCH 3/4] Placement for alarmCues --- web/skins/classic/views/event.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/skins/classic/views/event.php b/web/skins/classic/views/event.php index e0b97e768..2fd52728f 100644 --- a/web/skins/classic/views/event.php +++ b/web/skins/classic/views/event.php @@ -208,6 +208,7 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
+ + +