Skip to content

Commit

Permalink
Merge pull request #2898 from avalonmediasystem/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
yingfeng-iu authored Mar 30, 2018
2 parents dc80e43 + 9c1fa34 commit 95ff0ff
Show file tree
Hide file tree
Showing 76 changed files with 1,470 additions and 252 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Ignore bundler config.
/.bundle
vendor/bundle

# Ignore the default SQLite database.
/db/*.sqlite3
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ git:
bundler_args: --with postgres aws --without development debug
services:
- mysql2
- redis-server
before_install:
- sudo rm -vf /etc/apt/sources.list.d/*riak*
- sudo rm -vf /etc/apt/sources.list.d/*hhvm*
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source 'https://rubygems.org'
# Core rails
gem 'rails', '4.2.9'
gem 'sqlite3'
gem 'bootsnap', require: false

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

# Coding Patterns
gem 'config'
Expand Down
22 changes: 18 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ GEM
activejob (4.2.9)
activesupport (= 4.2.9)
globalid (>= 0.3.0)
activejob-traffic_control (0.1.3)
activejob (>= 4.2)
activesupport (>= 4.2)
suo
activemodel (4.2.9)
activesupport (= 4.2.9)
builder (~> 3.1)
Expand Down Expand Up @@ -251,6 +255,8 @@ GEM
blacklight (~> 6.0)
cancancan (~> 1.8)
deprecation (~> 1.0)
bootsnap (1.2.1)
msgpack (~> 1.0)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
Expand Down Expand Up @@ -320,6 +326,7 @@ GEM
safe_yaml (~> 1.0.0)
crass (1.0.3)
daemons (1.2.4)
dalli (2.7.6)
database_cleaner (1.6.1)
debug_inspector (0.0.3)
declarative (0.0.10)
Expand Down Expand Up @@ -490,7 +497,7 @@ GEM
activesupport (>= 4, < 5.2)
railties (>= 4, < 5.2)
request_store (~> 1.0)
loofah (2.1.1)
loofah (2.2.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.6.6)
Expand All @@ -511,6 +518,7 @@ GEM
mini_portile2 (2.3.0)
minitest (5.11.0)
mono_logger (1.1.0)
msgpack (1.2.0)
multi_json (1.12.2)
multi_xml (0.6.0)
multipart-post (2.0.0)
Expand All @@ -522,7 +530,7 @@ GEM
net-ssh (4.2.0)
netrc (0.11.0)
noid (0.9.0)
nokogiri (1.8.1)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
nom-xml (0.6.0)
activesupport (>= 3.2.18)
Expand Down Expand Up @@ -566,8 +574,8 @@ GEM
pry-rails (0.3.6)
pry (>= 0.10.4)
public_suffix (3.0.0)
rack (1.6.8)
rack-protection (1.5.3)
rack (1.6.9)
rack-protection (1.5.5)
rack
rack-test (0.6.3)
rack (>= 1.0)
Expand Down Expand Up @@ -780,6 +788,10 @@ GEM
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stomp (1.4.4)
suo (0.3.2)
dalli
msgpack
redis
sxp (1.0.0)
rdf (~> 2.0)
temple (0.8.0)
Expand Down Expand Up @@ -837,6 +849,7 @@ DEPENDENCIES
active_encode (~> 0.1.1)
active_fedora-datastreams
active_fedora-noid (~> 2.0.2)
activejob-traffic_control
activerecord-session_store
acts_as_list
api-pagination
Expand All @@ -846,6 +859,7 @@ DEPENDENCIES
aws-sdk-rails
bixby
blacklight (= 6.11.0)
bootsnap
bootstrap-toggle-rails!
bootstrap_form
browse-everything (~> 0.13.0)
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ explore the out-of-the-box functionality or do basic development.

* Ensure that you're running one of the Ruby versions listed in under rvm in ".travis.yml".
* Install [Mediainfo cli](http://mediainfo.sourceforge.net)
* 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
* ```cp config/authentication.yml.example config/authentication.yml```
* Create config overwrites in [``config/settings/development.local.yml``](https://wiki.dlib.indiana.edu/display/VarVideo/Configuration+Files#ConfigurationFiles-config/settings.yml) if necessary
* ```cp config/controlled_vocabulary.yml.example config/controlled_vocabulary.yml```
* Install [cmake](https://cmake.org/) if necessary. This can typically be installed via package manager
* ```bundle install```
Expand All @@ -35,7 +34,7 @@ explore the out-of-the-box functionality or do basic development.
* ```rake db:test:prepare```
* ``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

# Quickstart development with Docker (experimental)
# Quickstart development with Docker
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.
* Install [Docker](https://docs.docker.com/engine/installation/) and [docker-compose](https://docs.docker.com/compose/install/)
* ```git clone https://github.com/avalonmediasystem/avalon```
Expand All @@ -44,7 +43,7 @@ Docker provides an alternative way of setting up an Avalon Media System Developm
* ```docker-compose up```
* Try loading Avalon in your browser: ```localhost:3000```

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```.
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```.

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.

Expand Down
18 changes: 13 additions & 5 deletions app/assets/javascripts/file_browse.js.coffee
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2011-2018, The Trustees of Indiana University and Northwestern
# University. Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
#
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
Expand All @@ -19,14 +19,22 @@ $ ->
initialized = false
$('#browse-btn').browseEverything()
.show ->
alertMsg = $('<div>')
.html('Warning! Uploading too many files at once can lead to ingest failures.')
.addClass('alert')
.addClass('alert-danger')
.css('margin','3px')
.css('text-align','center')
$('.ev-body').prepend(alertMsg)
unless $('#browse-everything input[name=workflow]').length > 0
skip_box = $('#web_upload input[name=workflow]').closest('span')
.clone().removeClass().css('margin-right','10px')
$('.ev-cancel').before skip_box

$('.ev-providers .ev-container a').click()
initialized = true
.done (data) ->
.done (data) ->
if data.length > 0
$('#uploading').modal('show')
$('#dropbox_form input[name=workflow]').val($('#browse-everything input[name=workflow]:checked').val())
$('#dropbox_form').submit()
$('#dropbox_form').submit()
52 changes: 52 additions & 0 deletions app/assets/javascripts/intercom_push.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2011-2018, The Trustees of Indiana University and Northwestern
* University. Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* --- END LICENSE_HEADER BLOCK ---
*/
$('#intercom_push').on('shown.bs.modal', function(e) {
getIntercomCollections(false);
});
function getIntercomCollections(force, collections_path) {
select = $('#collection_id');
if (force || select.find('option').length === 0) {
$('#intercom_push_submit_button').prop('disabled', true);
select.find('option').remove();
select.append(
'<option value="" disabled="disabled" selected="selected">Fetching Collections from Target...</option>'
);
$.ajax({
type: 'GET',
url: collections_path,
format: 'json',
data: { reload: force },
success: function(result) {
select.find('option').remove();
$.each(result, function(i, c) {
var option = $('<option></option')
.attr('value', c['id'])
.text(c['name']);
if (c['default']) {
option.prop('selected', true);
}
select.append(option);
});
$('#intercom_push_submit_button').prop('disabled', false);
},
error: function(result) {
$('#intercom_push #collection_id')
.find('option')
.text('There was an error communicating with the target.');
}
});
}
}
38 changes: 36 additions & 2 deletions app/assets/javascripts/media_player_wrapper/avalon_player_new.es6
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ class MEJSPlayer {
this.mejsUtility = new MEJSUtility();
this.mejsTimeRailHelper = new MEJSTimeRailHelper();
this.mejsMarkersHelper = new MEJSMarkersHelper();
this.mejsQualityHelper = new MEJSQualityHelper();

// Unpack player configuration object for the new player.
// This allows for variable params to be sent in.
this.currentStreamInfo = configObj.currentStreamInfo || {};
this.features = configObj.features || {};
this.highlightRail = configObj.highlightRail;
this.playlistItem = configObj.playlistItem || {};
this.defaultQuality = configObj.defaultQuality || 'auto';

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

// Initialize switchPlayerHelper for mediafragment, if one exists
if (this.currentStreamInfo.t && this.currentStreamInfo.t[0] > 0) {
this.switchPlayerHelper.active = true;
this.switchPlayerHelper.data = {
fragmentbegin: this.currentStreamInfo.t[0],
fragmentend: this.currentStreamInfo.t[1]
};
this.switchPlayerHelper.paused = true;
}

// Array of all current segments for media object
this.segmentsMap = this.mejsUtility.createSegmentsMap(
document.getElementById('accordion'),
Expand Down Expand Up @@ -122,6 +134,7 @@ class MEJSPlayer {
* @return {void}
*/
getNewStreamAjax(id, url, playlistItemsT) {
$('.media-show-page').removeClass('ready-to-play');
$.ajax({
url: url + '/stream',
dataType: 'json',
Expand Down Expand Up @@ -149,6 +162,7 @@ class MEJSPlayer {
handleCanPlay() {
this.mediaElement.removeEventListener('canplay');
// Do we play a specified range of the media file?
$('.media-show-page').addClass('ready-to-play');
if (this.switchPlayerHelper.active) {
this.playRange();
}
Expand Down Expand Up @@ -234,7 +248,7 @@ class MEJSPlayer {
: parseFloat(this.segmentsMap[target.id].fragmentbegin);
this.mediaElement.setCurrentTime(time);
}

this.mejsUtility.showControlsBriefly(this.player);
}

Expand Down Expand Up @@ -270,7 +284,17 @@ class MEJSPlayer {
this.mejsUtility.highlightSectionLink();
}
}

/**
* MediaElement render error callback function
* @function handleError
* @param {Object} error - The error object
* @param {Object} mediaElement - The wrapper that mimics all the native events/properties/methods for all renderers
* @param {Object} originalNode - The original HTML video, audio or iframe tag where the media was loaded originally
* @return {void}
*/
handleError(error, mediaElement, originalNode) {
console.log('MEJS CREATE ERROR: ' + error);
}
/**
* MediaElement render success callback function
* @function handleSuccess
Expand Down Expand Up @@ -422,16 +446,26 @@ class MEJSPlayer {
features: this.features,
poster: currentStreamInfo.poster_image || null,
success: this.handleSuccess.bind(this),
error: this.handleError.bind(this),
embed_title: currentStreamInfo.embed_title,
link_back_url: currentStreamInfo.link_back_url,
qualityText: 'Stream Quality',
defaultQuality: this.defaultQuality,
toggleCaptionsButtonWhenOnlyOne: true
};
let promises = [];
const playlistIds = this.playlistItem
? [this.playlistItem.playlist_id, this.playlistItem.id]
: [];

// Remove quality feature for IE
if (
!!navigator.userAgent.match(/MSIE /) ||
!!navigator.userAgent.match(/Trident.*rv\:11\./)
) {
defaults.features = defaults.features.filter(e => e !== 'quality');
}

// Remove video player controls/plugins if it's not a video stream
if (!currentStreamInfo.is_video) {
defaults.features = defaults.features.filter(
Expand Down
Loading

0 comments on commit 95ff0ff

Please sign in to comment.