Skip to content

Commit 95ff0ff

Browse files
authored
Merge pull request #2898 from avalonmediasystem/staging
Staging
2 parents dc80e43 + 9c1fa34 commit 95ff0ff

File tree

76 files changed

+1470
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1470
-252
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
# Ignore bundler config.
88
/.bundle
9+
vendor/bundle
910

1011
# Ignore the default SQLite database.
1112
/db/*.sqlite3

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ git:
44
bundler_args: --with postgres aws --without development debug
55
services:
66
- mysql2
7+
- redis-server
78
before_install:
89
- sudo rm -vf /etc/apt/sources.list.d/*riak*
910
- sudo rm -vf /etc/apt/sources.list.d/*hhvm*

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
33
# Core rails
44
gem 'rails', '4.2.9'
55
gem 'sqlite3'
6+
gem 'bootsnap', require: false
67

78
# Assets
89
gem 'coffee-rails', '~> 4.1.0'
@@ -77,6 +78,7 @@ gem 'mediaelement-track-scrubber', git: 'https://github.com/avalonmediasystem/me
7778
gem 'redis-rails'
7879
gem 'resque', '~> 1.27.0'
7980
gem 'resque-scheduler', '~> 4.3.0'
81+
gem 'activejob-traffic_control'
8082

8183
# Coding Patterns
8284
gem 'config'

Gemfile.lock

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ GEM
185185
activejob (4.2.9)
186186
activesupport (= 4.2.9)
187187
globalid (>= 0.3.0)
188+
activejob-traffic_control (0.1.3)
189+
activejob (>= 4.2)
190+
activesupport (>= 4.2)
191+
suo
188192
activemodel (4.2.9)
189193
activesupport (= 4.2.9)
190194
builder (~> 3.1)
@@ -251,6 +255,8 @@ GEM
251255
blacklight (~> 6.0)
252256
cancancan (~> 1.8)
253257
deprecation (~> 1.0)
258+
bootsnap (1.2.1)
259+
msgpack (~> 1.0)
254260
bootstrap-sass (3.3.7)
255261
autoprefixer-rails (>= 5.2.1)
256262
sass (>= 3.3.4)
@@ -320,6 +326,7 @@ GEM
320326
safe_yaml (~> 1.0.0)
321327
crass (1.0.3)
322328
daemons (1.2.4)
329+
dalli (2.7.6)
323330
database_cleaner (1.6.1)
324331
debug_inspector (0.0.3)
325332
declarative (0.0.10)
@@ -490,7 +497,7 @@ GEM
490497
activesupport (>= 4, < 5.2)
491498
railties (>= 4, < 5.2)
492499
request_store (~> 1.0)
493-
loofah (2.1.1)
500+
loofah (2.2.1)
494501
crass (~> 1.0.2)
495502
nokogiri (>= 1.5.9)
496503
mail (2.6.6)
@@ -511,6 +518,7 @@ GEM
511518
mini_portile2 (2.3.0)
512519
minitest (5.11.0)
513520
mono_logger (1.1.0)
521+
msgpack (1.2.0)
514522
multi_json (1.12.2)
515523
multi_xml (0.6.0)
516524
multipart-post (2.0.0)
@@ -522,7 +530,7 @@ GEM
522530
net-ssh (4.2.0)
523531
netrc (0.11.0)
524532
noid (0.9.0)
525-
nokogiri (1.8.1)
533+
nokogiri (1.8.2)
526534
mini_portile2 (~> 2.3.0)
527535
nom-xml (0.6.0)
528536
activesupport (>= 3.2.18)
@@ -566,8 +574,8 @@ GEM
566574
pry-rails (0.3.6)
567575
pry (>= 0.10.4)
568576
public_suffix (3.0.0)
569-
rack (1.6.8)
570-
rack-protection (1.5.3)
577+
rack (1.6.9)
578+
rack-protection (1.5.5)
571579
rack
572580
rack-test (0.6.3)
573581
rack (>= 1.0)
@@ -780,6 +788,10 @@ GEM
780788
net-scp (>= 1.1.2)
781789
net-ssh (>= 2.8.0)
782790
stomp (1.4.4)
791+
suo (0.3.2)
792+
dalli
793+
msgpack
794+
redis
783795
sxp (1.0.0)
784796
rdf (~> 2.0)
785797
temple (0.8.0)
@@ -837,6 +849,7 @@ DEPENDENCIES
837849
active_encode (~> 0.1.1)
838850
active_fedora-datastreams
839851
active_fedora-noid (~> 2.0.2)
852+
activejob-traffic_control
840853
activerecord-session_store
841854
acts_as_list
842855
api-pagination
@@ -846,6 +859,7 @@ DEPENDENCIES
846859
aws-sdk-rails
847860
bixby
848861
blacklight (= 6.11.0)
862+
bootsnap
849863
bootstrap-toggle-rails!
850864
bootstrap_form
851865
browse-everything (~> 0.13.0)

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ explore the out-of-the-box functionality or do basic development.
2424

2525
* Ensure that you're running one of the Ruby versions listed in under rvm in ".travis.yml".
2626
* Install [Mediainfo cli](http://mediainfo.sourceforge.net)
27-
* Copy config/avalon.yml.example to config/avalon.yml and [change](https://wiki.dlib.indiana.edu/display/VarVideo/Configuration+Files#ConfigurationFiles-config%2Favalon.yml) as necessary
28-
* ```cp config/authentication.yml.example config/authentication.yml```
27+
* Create config overwrites in [``config/settings/development.local.yml``](https://wiki.dlib.indiana.edu/display/VarVideo/Configuration+Files#ConfigurationFiles-config/settings.yml) if necessary
2928
* ```cp config/controlled_vocabulary.yml.example config/controlled_vocabulary.yml```
3029
* Install [cmake](https://cmake.org/) if necessary. This can typically be installed via package manager
3130
* ```bundle install```
@@ -35,7 +34,7 @@ explore the out-of-the-box functionality or do basic development.
3534
* ```rake db:test:prepare```
3635
* ``bundle exec rake server:development`` or ``bundle exec rake server:test`` Note: This process will not background itself, it will occupy the terminal you run it in
3736

38-
# Quickstart development with Docker (experimental)
37+
# Quickstart development with Docker
3938
Docker provides an alternative way of setting up an Avalon Media System Development Environment in minutes without installing any dependencies beside Docker itself. It should be noted that the docker-compose.yml provided here is for development only and will be updated continually.
4039
* Install [Docker](https://docs.docker.com/engine/installation/) and [docker-compose](https://docs.docker.com/compose/install/)
4140
* ```git clone https://github.com/avalonmediasystem/avalon```
@@ -44,7 +43,7 @@ Docker provides an alternative way of setting up an Avalon Media System Developm
4443
* ```docker-compose up```
4544
* Try loading Avalon in your browser: ```localhost:3000```
4645

47-
Avalon is served by Webrick in development mode so any changes will be picked up automatically. Running a Rails command inside the Avalon container is easy, for example, to run tests ```docker exec -it avalon_avalon_1 bash -c "RAILS_ENV=test bundle exec rspec"```. Note: to avoid erasing development data, you should use the test stack to run tests```docker-compose -f test.yml up```.
46+
Avalon is served by Webrick in development mode so any changes will be picked up automatically. Running a Rails command inside the Avalon container is easy, for example, to run tests ```docker-compose exec avalon bash -c "RAILS_ENV=test bundle exec rspec"```. Note: to avoid erasing development data, you should use the test stack to run tests```docker-compose -f test.yml up```.
4847

4948
Rails debugging with Pry can be accessed by attaching to the docker container: ```docker attach container_name```. Now, when you reach a binding.pry breakpoint in rails, you can step through the breakpoint in that newly attached session.
5049

app/assets/javascripts/file_browse.js.coffee

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Copyright 2011-2018, The Trustees of Indiana University and Northwestern
22
# University. Licensed under the Apache License, Version 2.0 (the "License");
33
# you may not use this file except in compliance with the License.
4-
#
4+
#
55
# You may obtain a copy of the License at
6-
#
6+
#
77
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
8+
#
99
# Unless required by applicable law or agreed to in writing, software distributed
1010
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
1111
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
@@ -19,14 +19,22 @@ $ ->
1919
initialized = false
2020
$('#browse-btn').browseEverything()
2121
.show ->
22+
alertMsg = $('<div>')
23+
.html('Warning! Uploading too many files at once can lead to ingest failures.')
24+
.addClass('alert')
25+
.addClass('alert-danger')
26+
.css('margin','3px')
27+
.css('text-align','center')
28+
$('.ev-body').prepend(alertMsg)
2229
unless $('#browse-everything input[name=workflow]').length > 0
2330
skip_box = $('#web_upload input[name=workflow]').closest('span')
2431
.clone().removeClass().css('margin-right','10px')
2532
$('.ev-cancel').before skip_box
2633

2734
$('.ev-providers .ev-container a').click()
2835
initialized = true
29-
.done (data) ->
36+
.done (data) ->
3037
if data.length > 0
38+
$('#uploading').modal('show')
3139
$('#dropbox_form input[name=workflow]').val($('#browse-everything input[name=workflow]:checked').val())
32-
$('#dropbox_form').submit()
40+
$('#dropbox_form').submit()
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright 2011-2018, The Trustees of Indiana University and Northwestern
3+
* University. Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
*
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software distributed
11+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
* specific language governing permissions and limitations under the License.
14+
* --- END LICENSE_HEADER BLOCK ---
15+
*/
16+
$('#intercom_push').on('shown.bs.modal', function(e) {
17+
getIntercomCollections(false);
18+
});
19+
function getIntercomCollections(force, collections_path) {
20+
select = $('#collection_id');
21+
if (force || select.find('option').length === 0) {
22+
$('#intercom_push_submit_button').prop('disabled', true);
23+
select.find('option').remove();
24+
select.append(
25+
'<option value="" disabled="disabled" selected="selected">Fetching Collections from Target...</option>'
26+
);
27+
$.ajax({
28+
type: 'GET',
29+
url: collections_path,
30+
format: 'json',
31+
data: { reload: force },
32+
success: function(result) {
33+
select.find('option').remove();
34+
$.each(result, function(i, c) {
35+
var option = $('<option></option')
36+
.attr('value', c['id'])
37+
.text(c['name']);
38+
if (c['default']) {
39+
option.prop('selected', true);
40+
}
41+
select.append(option);
42+
});
43+
$('#intercom_push_submit_button').prop('disabled', false);
44+
},
45+
error: function(result) {
46+
$('#intercom_push #collection_id')
47+
.find('option')
48+
.text('There was an error communicating with the target.');
49+
}
50+
});
51+
}
52+
}

app/assets/javascripts/media_player_wrapper/avalon_player_new.es6

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ class MEJSPlayer {
2929
this.mejsUtility = new MEJSUtility();
3030
this.mejsTimeRailHelper = new MEJSTimeRailHelper();
3131
this.mejsMarkersHelper = new MEJSMarkersHelper();
32+
this.mejsQualityHelper = new MEJSQualityHelper();
3233

3334
// Unpack player configuration object for the new player.
3435
// This allows for variable params to be sent in.
3536
this.currentStreamInfo = configObj.currentStreamInfo || {};
3637
this.features = configObj.features || {};
3738
this.highlightRail = configObj.highlightRail;
3839
this.playlistItem = configObj.playlistItem || {};
40+
this.defaultQuality = configObj.defaultQuality || 'auto';
3941

4042
// Tracks whether we're loading the page or just reloading player
4143
this.isFirstLoad = true;
@@ -58,6 +60,16 @@ class MEJSPlayer {
5860
paused: false
5961
};
6062

63+
// Initialize switchPlayerHelper for mediafragment, if one exists
64+
if (this.currentStreamInfo.t && this.currentStreamInfo.t[0] > 0) {
65+
this.switchPlayerHelper.active = true;
66+
this.switchPlayerHelper.data = {
67+
fragmentbegin: this.currentStreamInfo.t[0],
68+
fragmentend: this.currentStreamInfo.t[1]
69+
};
70+
this.switchPlayerHelper.paused = true;
71+
}
72+
6173
// Array of all current segments for media object
6274
this.segmentsMap = this.mejsUtility.createSegmentsMap(
6375
document.getElementById('accordion'),
@@ -122,6 +134,7 @@ class MEJSPlayer {
122134
* @return {void}
123135
*/
124136
getNewStreamAjax(id, url, playlistItemsT) {
137+
$('.media-show-page').removeClass('ready-to-play');
125138
$.ajax({
126139
url: url + '/stream',
127140
dataType: 'json',
@@ -149,6 +162,7 @@ class MEJSPlayer {
149162
handleCanPlay() {
150163
this.mediaElement.removeEventListener('canplay');
151164
// Do we play a specified range of the media file?
165+
$('.media-show-page').addClass('ready-to-play');
152166
if (this.switchPlayerHelper.active) {
153167
this.playRange();
154168
}
@@ -234,7 +248,7 @@ class MEJSPlayer {
234248
: parseFloat(this.segmentsMap[target.id].fragmentbegin);
235249
this.mediaElement.setCurrentTime(time);
236250
}
237-
251+
238252
this.mejsUtility.showControlsBriefly(this.player);
239253
}
240254

@@ -270,7 +284,17 @@ class MEJSPlayer {
270284
this.mejsUtility.highlightSectionLink();
271285
}
272286
}
273-
287+
/**
288+
* MediaElement render error callback function
289+
* @function handleError
290+
* @param {Object} error - The error object
291+
* @param {Object} mediaElement - The wrapper that mimics all the native events/properties/methods for all renderers
292+
* @param {Object} originalNode - The original HTML video, audio or iframe tag where the media was loaded originally
293+
* @return {void}
294+
*/
295+
handleError(error, mediaElement, originalNode) {
296+
console.log('MEJS CREATE ERROR: ' + error);
297+
}
274298
/**
275299
* MediaElement render success callback function
276300
* @function handleSuccess
@@ -422,16 +446,26 @@ class MEJSPlayer {
422446
features: this.features,
423447
poster: currentStreamInfo.poster_image || null,
424448
success: this.handleSuccess.bind(this),
449+
error: this.handleError.bind(this),
425450
embed_title: currentStreamInfo.embed_title,
426451
link_back_url: currentStreamInfo.link_back_url,
427452
qualityText: 'Stream Quality',
453+
defaultQuality: this.defaultQuality,
428454
toggleCaptionsButtonWhenOnlyOne: true
429455
};
430456
let promises = [];
431457
const playlistIds = this.playlistItem
432458
? [this.playlistItem.playlist_id, this.playlistItem.id]
433459
: [];
434460

461+
// Remove quality feature for IE
462+
if (
463+
!!navigator.userAgent.match(/MSIE /) ||
464+
!!navigator.userAgent.match(/Trident.*rv\:11\./)
465+
) {
466+
defaults.features = defaults.features.filter(e => e !== 'quality');
467+
}
468+
435469
// Remove video player controls/plugins if it's not a video stream
436470
if (!currentStreamInfo.is_video) {
437471
defaults.features = defaults.features.filter(

0 commit comments

Comments
 (0)