Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.6.3 #183

Merged
merged 4 commits into from
Mar 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
video_xblock/static/js/player_state.js
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"globals": {
"videojs": true,
"domReady": true,
"getXblockUsageId": true,
"getTranscriptUrl": true,
"getDownloadTranscriptUrl": true,
"showStatus": true,
"gettext": true
},
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [0.6.3] - 2017-03-30

### Changed

- Extend Brightcove url regex to include additional set of video urls.
Now it supports both:
- `https://studio.brightcove.com/products/videos/<media-id>`
- `https://studio.brightcove.com/products/videocloud/media/videos/<media-id>`
- Restructure JavaScript codebase.

## [0.6.2] - 2017-03-27

### Changed
Expand Down Expand Up @@ -137,4 +147,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
[0.6.0]: https://github.com/raccoongang/xblock-video/compare/v0.5.0...v0.6.0
[0.6.1]: https://github.com/raccoongang/xblock-video/compare/v0.6.0...v0.6.1
[0.6.2]: https://github.com/raccoongang/xblock-video/compare/v0.6.1...v0.6.2
[Unreleased]: https://github.com/raccoongang/xblock-video/compare/v0.6.2...HEAD
[0.6.3]: https://github.com/raccoongang/xblock-video/compare/v0.6.2...v0.6.3
[Unreleased]: https://github.com/raccoongang/xblock-video/compare/v0.6.3...HEAD
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ clean: # Clean working directory

test: test-py test-js ## Run tests

test-py: deps-test ## Run Python tests
test-py: ## Run Python tests
nosetests video_xblock --with-coverage --cover-package=video_xblock

test-js: tools
test-js: ## Run JavaScript tests
karma start video_xblock/static/video_xblock_karma.conf.js

quality: quality-py quality-js ## Run code quality checks
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pip install --process-dependency-links -e "git+https://github.com/raccoongang/xb

## Enabling in Studio

You can enable the Wistia xblock in studio through the advanced
You can enable the Video xblock in studio through the advanced
settings:

1. From the main page of a specific course, click on *Settings*,
Expand Down Expand Up @@ -70,7 +70,7 @@ Sample default settings in `/edx/app/edxapp/cms.env.json`:
Install dependencies and development tools:

```shell
> make deps deps-test tools
> make tools deps-test
```

Run quality checks:
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from setuptools import setup


VERSION = '0.6.2'
VERSION = '0.6.3'
DESCRIPTION = 'Video XBlock to embed videos hosted on different video platforms into your courseware'


Expand Down Expand Up @@ -34,6 +34,7 @@ def package_data(pkg, roots):
],
dependency_links=[
# At the moment of writing PyPI hosts outdated version of xblock-utils, hence git
# Replace dependency links with numbered versions when it's released on PyPI
'git+https://github.com/edx/[email protected]#egg=xblock-utils-1.0.2',
'git+https://github.com/edx/[email protected]#egg=xblock-utils-1.0.3',
],
Expand Down
24 changes: 12 additions & 12 deletions video_xblock/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def basic_fields(self):

Subclasses can extend or redefine list if needed. Defaults to a tuple defined by VideoXBlock.
"""
return ('display_name', 'href')
return ['display_name', 'href']

@property
def advanced_fields(self):
Expand All @@ -130,11 +130,11 @@ def advanced_fields(self):

Subclasses can extend or redefine list if needed. Defaults to a tuple defined by VideoXBlock.
"""
return (
return [
'start_time', 'end_time', 'handout', 'transcripts',
'threeplaymedia_file_id', 'threeplaymedia_apikey', 'download_transcript_allowed',
'default_transcripts', 'download_video_allowed', 'download_video_url'
)
]

@property
def fields_help(self):
Expand Down Expand Up @@ -173,22 +173,22 @@ def get_frag(self, **context):
'static/vendor/js/video.min.js',
'static/vendor/js/videojs-contextmenu.min.js',
'static/vendor/js/videojs-contextmenu-ui.min.js',
'static/js/video-speed.js',
'static/js/player_state.js',
'static/js/videojs-speed-handler.js'
'static/js/videojs/video-speed.js',
'static/js/student-view/player-state.js',
'static/js/videojs/videojs-speed-handler.js'
]

if json.loads(context['player_state'])['transcripts']:
js_files += [
'static/vendor/js/videojs-transcript.min.js',
'static/js/transcript-download.js',
'static/js/videojs-transcript.js'
'static/js/student-view/transcript-download.js',
'static/js/videojs/videojs-transcript.js'
]

js_files += [
'static/js/videojs-tabindex.js',
'static/js/toggle-button.js',
'static/js/videojs_event_plugin.js'
'static/js/videojs/videojs-tabindex.js',
'static/js/videojs/toggle-button.js',
'static/js/videojs/videojs-event-plugin.js'
]

for js_file in js_files:
Expand Down Expand Up @@ -216,7 +216,7 @@ def player_data_setup(context):
"offset": {
"start": context['start_time'],
"end": context['end_time'],
"current_time": context['player_state']['current_time'],
"current_time": context['player_state']['currentTime'],
},
"videoJSSpeedHandler": {},
}
Expand Down
21 changes: 12 additions & 9 deletions video_xblock/backends/brightcove.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class BrightcovePlayer(BaseVideoPlayer, BrightcoveHlsMixin):
BrightcovePlayer is used for videos hosted on the Brightcove Video Cloud.
"""

url_re = re.compile(r'https:\/\/studio.brightcove.com\/products\/videocloud\/media\/videos\/(?P<media_id>\d+)')
url_re = re.compile(r'https:\/\/studio.brightcove.com\/products(?:\/videocloud\/media)?\/videos\/(?P<media_id>\d+)')
metadata_fields = ['access_token', 'client_id', 'client_secret', ]

# Current api for requesting transcripts.
Expand Down Expand Up @@ -334,7 +334,7 @@ def basic_fields(self):

Brightcove videos require Brightcove Account id.
"""
return super(BrightcovePlayer, self).basic_fields + ('account_id',)
return super(BrightcovePlayer, self).basic_fields + ['account_id']

@property
def advanced_fields(self):
Expand All @@ -343,7 +343,10 @@ def advanced_fields(self):

Brightcove videos require Brightcove Account id.
"""
return ('player_id',) + super(BrightcovePlayer, self).advanced_fields
fields_list = ['player_id'] + super(BrightcovePlayer, self).advanced_fields
# Add `token` field before `threeplaymedia_file_id`
fields_list.insert(fields_list.index('threeplaymedia_file_id'), 'token')
return fields_list

fields_help = {
'token': 'You can generate a BC token following the guide of '
Expand Down Expand Up @@ -387,12 +390,12 @@ def get_frag(self, **context):
)
js_files = [
'static/js/base.js',
'static/js/toggle-button.js'
'static/js/videojs/toggle-button.js'
]
js_files += [
'static/js/videojs-tabindex.js',
'static/js/videojs_event_plugin.js',
'static/js/brightcove-videojs-init.js'
'static/js/videojs/videojs-tabindex.js',
'static/js/videojs/videojs-event-plugin.js',
'static/js/videojs/brightcove-videojs-init.js'
]

for js_file in js_files:
Expand All @@ -411,14 +414,14 @@ def get_player_html(self, **context):
self.resource_string(
'static/vendor/js/videojs-offset.min.js'
),
self.resource_string('static/js/videojs-speed-handler.js')
self.resource_string('static/js/videojs/videojs-speed-handler.js')
]
if context.get('transcripts'):
vjs_plugins += [
self.resource_string(
'static/vendor/js/videojs-transcript.min.js'
),
self.resource_string('static/js/videojs-transcript.js')
self.resource_string('static/js/videojs/videojs-transcript.js')
]
context['vjs_plugins'] = vjs_plugins
return super(BrightcovePlayer, self).get_player_html(**context)
Expand Down
6 changes: 3 additions & 3 deletions video_xblock/backends/html5.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def advanced_fields(self):

Hide `download_video_url` field for Html5Player.
"""
return tuple(
return [
field for field in super(Html5Player, self).advanced_fields
if field not in self.exclude_advanced_fields
)
]

exclude_advanced_fields = ('default_transcripts', 'download_video_url')

Expand Down Expand Up @@ -57,7 +57,7 @@ def get_frag(self, **context):
)
js_files = [
'static/vendor/js/videojs-offset.min.js',
'static/js/player-context-menu.js'
'static/js/videojs/player-context-menu.js'
]

for js_file in js_files:
Expand Down
18 changes: 13 additions & 5 deletions video_xblock/backends/wistia.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ class WistiaPlayer(BaseVideoPlayer):
'Please ensure appropriate operations scope has been set on the video platform.'
}

@property
def advanced_fields(self):
"""
Tuple of VideoXBlock fields to display in Basic tab of edit modal window.

Brightcove videos require Brightcove Account id.
"""
fields_list = super(WistiaPlayer, self).advanced_fields
# Add `token` field before `threeplaymedia_file_id`
fields_list.insert(fields_list.index('threeplaymedia_file_id'), 'token')
return fields_list

def media_id(self, href):
"""
Extract Platform's media id from the video url.
Expand All @@ -78,14 +90,10 @@ def get_frag(self, **context):
self.render_resource('static/html/wistiavideo.html', **context)
)

frag.add_javascript(
self.render_resource('static/js/context.js', **context)
)

js_files = [
'static/vendor/js/vjs.wistia.js',
'static/vendor/js/videojs-offset.min.js',
'static/js/player-context-menu.js'
'static/js/videojs/player-context-menu.js'
]

for js_file in js_files:
Expand Down
16 changes: 16 additions & 0 deletions video_xblock/static/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,19 @@ var domReady = function(callback) {
document.addEventListener('DOMContentLoaded', callback);
}
};

/** Get XblockUsageId from xblock's url. */
var getXblockUsageId = function() {
'use strict';
return window.location.hash.slice(1);
};

/** Get transcript url for current caption language */
var getDownloadTranscriptUrl = function(transcripts, player) {
'use strict';
var downloadTranscriptUrl;
if (transcripts[player.captionsLanguage]) {
downloadTranscriptUrl = transcripts[player.captionsLanguage].url;
}
return downloadTranscriptUrl;
};
Loading