Add plyr as player default and remove NodeJS, npm and videojs

This commit is contained in:
Jesús 2022-02-28 07:51:38 +08:00
parent 958aea0821
commit 1079d1cee4
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766
43 changed files with 36068 additions and 259 deletions

View File

@ -1,3 +0,0 @@
{"directory": "extlib/",
"analytics": false
}

View File

@ -2,8 +2,6 @@ image: debian/buster
packages: packages:
# Install bootstrap and configure dependencies. # Install bootstrap and configure dependencies.
- automake - automake
- nodejs
- npm
- python3-dev - python3-dev
- virtualenv - virtualenv

View File

@ -2,8 +2,6 @@ image: debian/bullseye
packages: packages:
# Install bootstrap and configure dependencies. # Install bootstrap and configure dependencies.
- automake - automake
- nodejs
- npm
- python3-dev - python3-dev
- virtualenv - virtualenv
@ -71,4 +69,3 @@ tasks:
# Build the documentation. # Build the documentation.
cd docs && make html cd docs && make html

View File

@ -4,11 +4,9 @@ packages:
- automake - automake
# - gcc # - gcc
# - make # - make
- nodejs
- npm
- python3-devel - python3-devel
- virtualenv - virtualenv
# Install make and runtime dependencies. # Install make and runtime dependencies.
# - findutils # - findutils
- python3-lxml - python3-lxml
@ -34,7 +32,7 @@ packages:
- python3-gobject - python3-gobject
- python3-gstreamer1 - python3-gstreamer1
- gstreamer1-plugin-openh264 - gstreamer1-plugin-openh264
# # Install raw image dependencies. # # Install raw image dependencies.
# - libexiv2-dev # - libexiv2-dev
# - libboost-python-dev # - libboost-python-dev
@ -47,7 +45,7 @@ packages:
# Install OpenID dependencies. # Install OpenID dependencies.
- python3-openid - python3-openid
tasks: tasks:
- core: | - core: |
cd mediagoblin cd mediagoblin

View File

@ -2,8 +2,6 @@ image: ubuntu/20.04
packages: packages:
# Install bootstrap and configure dependencies. # Install bootstrap and configure dependencies.
- automake - automake
- nodejs
- npm
- python3-dev - python3-dev
- virtualenv - virtualenv
@ -69,4 +67,3 @@ tasks:
# Build the documentation. # Build the documentation.
cd docs && make html cd docs && make html

View File

@ -5,7 +5,6 @@
bin bin
lib lib
lib64 lib64
node_modules
user_dev user_dev
.tox .tox
dist dist

3
.gitignore vendored
View File

@ -29,7 +29,6 @@
/.eggs/ /.eggs/
/env /env
/mediagoblin.ini /mediagoblin.ini
/node_modules/
/pip-selfcheck.json /pip-selfcheck.json
# pyconfigure/automake generated files # pyconfigure/automake generated files
@ -62,8 +61,6 @@ venv*
# extlib things # extlib things
/extlib/jquery/ /extlib/jquery/
/extlib/leaflet/ /extlib/leaflet/
/extlib/video.js/
/extlib/videojs-resolution-switcher
# Mac files # Mac files
.DS_Store .DS_Store

12
.gitmodules vendored
View File

@ -1,9 +1,15 @@
[submodule "extlib/jquery"]
path = extlib/jquery
url = https://github.com/jquery/jquery
[submodule "extlib/leaflet"]
path = extlib/leaflet
url = https://github.com/Leaflet/Leaflet
[submodule "extlib/pdf.js"] [submodule "extlib/pdf.js"]
path = extlib/pdf.js path = extlib/pdf.js
url = https://github.com/mozilla/pdf.js.git url = https://github.com/mozilla/pdf.js.git
[submodule "extlib/skeleton"]
path = extlib/skeleton
url = https://github.com/dhg/Skeleton.git
[submodule "extlib/sandyseventiesspeedboat"] [submodule "extlib/sandyseventiesspeedboat"]
path = extlib/sandyseventiesspeedboat path = extlib/sandyseventiesspeedboat
url = https://github.com/jpope777/sandyseventiesspeedboat-mg.git url = https://github.com/jpope777/sandyseventiesspeedboat-mg.git
[submodule "extlib/skeleton"]
path = extlib/skeleton
url = https://github.com/dhg/Skeleton.git

View File

@ -59,8 +59,6 @@ FROM debian:bullseye
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
automake \ automake \
git \ git \
nodejs \
npm \
python3-dev \ python3-dev \
virtualenv virtualenv

View File

@ -15,8 +15,6 @@ automake \
gcc \ gcc \
git-core \ git-core \
make \ make \
nodejs \
npm \
python3-devel \ python3-devel \
virtualenv virtualenv

View File

@ -23,5 +23,4 @@ include COPYING AUTHORS
include lazyserver.sh lazystarter.sh lazycelery.sh runtests.sh include lazyserver.sh lazystarter.sh lazycelery.sh runtests.sh
include configure.ac configure install-sh include configure.ac configure install-sh
include Makefile.in include Makefile.in
include bower.json
include mediagoblin/static/metadata/rdfa11.jsonld include mediagoblin/static/metadata/rdfa11.jsonld

View File

@ -9,11 +9,11 @@
# without any warranty. # without any warranty.
# List whatever files you want to include in your source distribution here. # List whatever files you want to include in your source distribution here.
# You can include whole directories but note that *everything* under that # You can include whole directories but note that *everything* under that
# directory will be included # directory will be included
DISTFILES = PKG-INFO Makefile.in configure setup.py install-sh DISTFILES = PKG-INFO Makefile.in configure setup.py install-sh
DESTDIR = DESTDIR =
VPATH = @srcdir@ VPATH = @srcdir@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_NAME = @PACKAGE_NAME@
@ -46,7 +46,7 @@ pkgdatadir = $(datadir)/@PACKAGE_NAME@
pkgincludedir = $(includedir)/@PACKAGE_NAME@ pkgincludedir = $(includedir)/@PACKAGE_NAME@
PYTHONPATH = $(pythondir)$(PATH_SEPARATOR)$(DESTDIR)$(pythondir) PYTHONPATH = $(pythondir)$(PATH_SEPARATOR)$(DESTDIR)$(pythondir)
EXTLIB_INSTALLS = extlib/jquery extlib/video.js extlib/leaflet EXTLIB_INSTALLS = extlib/jquery extlib/leaflet
# pkgpythondir = @pkgpythondir@ # pkgpythondir = @pkgpythondir@
# pkgpyexecdir = @pkgpyexecdir@ # pkgpyexecdir = @pkgpyexecdir@
@ -75,14 +75,14 @@ else
maybe_venved = maybe_venved =
maybe_venved_python = $(PYTHON) maybe_venved_python = $(PYTHON)
# No need for commands to build virtualenv as a dependency! # No need for commands to build virtualenv as a dependency!
maybe_venv_dep = maybe_venv_dep =
# Nor to clean up! # Nor to clean up!
maybe_venv_clean = maybe_venv_clean =
endif endif
.PHONY: all install uninstall distclean info install-html html \ .PHONY: all install uninstall distclean info install-html html \
install-pdf pdf install-dvi dvi install-ps ps clean dist check \ install-pdf pdf install-dvi dvi install-ps ps clean dist check \
installdirs i18n virtualenv docs extlib installdirs i18n virtualenv docs
# update postgresql # update postgresql
@ -95,11 +95,6 @@ else
cd docs && make html cd docs && make html
endif endif
# In the future we may provide more options than just npm/bower here
# eg, we may support guix updating.
extlib:
./devtools/update_extlib.sh
develop: $(maybe_venv_dep) i18n mediagoblin.ini develop: $(maybe_venv_dep) i18n mediagoblin.ini
# NEVER clobber a user's mediagoblin.ini once they've defined it # NEVER clobber a user's mediagoblin.ini once they've defined it
@ -131,16 +126,16 @@ clean-virtualenv:
rm -rf ./include/ rm -rf ./include/
endif endif
# setup.py doesn't (yet) support an uninstall command, so until it does, you # setup.py doesn't (yet) support an uninstall command, so until it does, you
# must manually remove everything that was installed here. The following example # must manually remove everything that was installed here. The following example
# should remove a basic package installed via setup.py, but please double- and # should remove a basic package installed via setup.py, but please double- and
# triple-check it so that you don't remove something you shouldn't! # triple-check it so that you don't remove something you shouldn't!
# Be sure to remove any extra files you install, such as binaries or documentation! # Be sure to remove any extra files you install, such as binaries or documentation!
# #
# uninstall: # uninstall:
# rm -rvf $(pkgpythondir) # rm -rvf $(pkgpythondir)
# rm -v $(pythondir)/$(PACKAGE_DISTNAME)-*.egg-info # rm -v $(pythondir)/$(PACKAGE_DISTNAME)-*.egg-info
# #
# We don't know what this does yet. # We don't know what this does yet.
# Originally: # Originally:
@ -163,7 +158,6 @@ distclean: $(maybe_venv_clean)
rm -rvf $(srcdir)/autom4te.cache rm -rvf $(srcdir)/autom4te.cache
rm -vf $(srcdir)/aclocal.m4 rm -vf $(srcdir)/aclocal.m4
rm -rf $(EXTLIB_INSTALLS) rm -rf $(EXTLIB_INSTALLS)
rm -rf node_modules
rm -vf $(srcdir)/Makefile rm -vf $(srcdir)/Makefile
check: check:

View File

@ -1,20 +0,0 @@
{
"name": "mediagoblin-extlib",
"description": "External libraries used by GNU MediaGoblin",
"author": "MediaGoblin team <devel@mediagoblin.org>",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"extlib/",
"test",
"tests"
],
"dependencies": {
"jquery": "~2.1.3",
"video.js": "~5.20.1",
"videojs-resolution-switcher": "~0.4.2",
"leaflet": "~0.7.3"
}
}

View File

@ -1,41 +0,0 @@
#!/bin/sh
# GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2015 GNU MediaGoblin Contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -e
# Make sure we have npm available
if ! which npm > /dev/null 2>&1; then
echo "Can't find npm, no way to install extlib :(";
exit 1;
fi
# Install bower if need be
if which bower > /dev/null 2>&1; then
BOWER=`which bower`;
elif [ -f ./node_modules/.bin/bower ]; then
BOWER="./node_modules/.bin/bower";
else
echo "Bower not found, installing via npm!";
npm install bower;
BOWER="./node_modules/.bin/bower";
fi
# Do package/file installs
$BOWER install

View File

@ -42,10 +42,10 @@ alternative deployment options.
Throughout the documentation we use the ``sudo`` command to indicate that Throughout the documentation we use the ``sudo`` command to indicate that
an instruction requires elevated user privileges to run. You can issue an instruction requires elevated user privileges to run. You can issue
these commands as the ``root`` user if you prefer. these commands as the ``root`` user if you prefer.
If you need help configuring ``sudo``, see the If you need help configuring ``sudo``, see the
`Debian wiki <https://wiki.debian.org/sudo/>`_ or the `Debian wiki <https://wiki.debian.org/sudo/>`_ or the
`Fedora Project wiki <https://fedoraproject.org/wiki/Configuring_Sudo/>`_. `Fedora Project wiki <https://fedoraproject.org/wiki/Configuring_Sudo/>`_.
Prepare System Prepare System
@ -63,7 +63,6 @@ MediaGoblin has the following core dependencies:
- `Python Imaging Library <http://www.pythonware.com/products/pil/>`_ - `Python Imaging Library <http://www.pythonware.com/products/pil/>`_
(PIL or Pillow) (PIL or Pillow)
- `virtualenv <http://www.virtualenv.org/>`_ - `virtualenv <http://www.virtualenv.org/>`_
- `Node.js <https://nodejs.org>`_
These instructions have been tested on Debian 11 and Fedora 33. These These instructions have been tested on Debian 11 and Fedora 33. These
instructions should approximately translate to recent Debian instructions should approximately translate to recent Debian
@ -76,11 +75,11 @@ Issue the following commands:
# Debian 11 # Debian 11
sudo apt update sudo apt update
sudo apt install automake git nodejs npm python3-dev \ sudo apt install automake git python3-dev \
python3-gst-1.0 python3-lxml python3-pil virtualenv python3-gst-1.0 python3-lxml python3-pil virtualenv
# Fedora 33 # Fedora 33
sudo dnf install automake gcc git-core make nodejs npm \ sudo dnf install automake gcc git-core make \
libffi-devel python3-devel python3-lxml python3-pillow \ libffi-devel python3-devel python3-lxml python3-pillow \
virtualenv virtualenv
@ -169,7 +168,7 @@ MediaGoblin does not require special permissions or elevated
access to run. As such, the preferred way to run MediaGoblin is to access to run. As such, the preferred way to run MediaGoblin is to
create a dedicated, unprivileged system user for the sole purpose of running create a dedicated, unprivileged system user for the sole purpose of running
MediaGoblin. Running MediaGoblin processes under an unprivileged system user MediaGoblin. Running MediaGoblin processes under an unprivileged system user
helps to keep it more secure. helps to keep it more secure.
The following command will create a system account with a username of The following command will create a system account with a username of
``mediagoblin``. ``mediagoblin``.
@ -191,10 +190,10 @@ read the media files that users upload (images, videos, etc.)
Many operating systems will automatically create a group Many operating systems will automatically create a group
``mediagoblin`` to go with the new user ``mediagoblin``, but just to ``mediagoblin`` to go with the new user ``mediagoblin``, but just to
be sure:: be sure::
sudo groupadd --force mediagoblin sudo groupadd --force mediagoblin
sudo usermod --append --groups mediagoblin mediagoblin sudo usermod --append --groups mediagoblin mediagoblin
No password will be assigned to this account, and you will not be able No password will be assigned to this account, and you will not be able
to log in as this user. To switch to this account, enter:: to log in as this user. To switch to this account, enter::
@ -209,7 +208,7 @@ Create a MediaGoblin Directory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You should create a working directory for MediaGoblin. This document You should create a working directory for MediaGoblin. This document
assumes your local git repository will be located at assumes your local git repository will be located at
``/srv/mediagoblin.example.org/mediagoblin/``. ``/srv/mediagoblin.example.org/mediagoblin/``.
Substitute your preferred local deployment path as needed. Substitute your preferred local deployment path as needed.
@ -489,7 +488,7 @@ created::
sudo find /opt/mediagoblin.example.org/mediagoblin/bin -type f -exec chmod 750 {} \; sudo find /opt/mediagoblin.example.org/mediagoblin/bin -type f -exec chmod 750 {} \;
.. note:: .. note::
If you see an Nginx placeholder page, you may need to remove the If you see an Nginx placeholder page, you may need to remove the
Nginx default configuration, or explictly set a ``server_name`` Nginx default configuration, or explictly set a ``server_name``
directive in the Nginx config. directive in the Nginx config.

1
extlib/jquery Submodule

@ -0,0 +1 @@
Subproject commit 683ceb8ff067ac53a7cb464ba1ec3f88e353e3f5

1
extlib/leaflet Submodule

@ -0,0 +1 @@
Subproject commit 8a5fdfc6e3db2807b8f0dd617474e4ab2949142b

BIN
extlib/plyr/blank.webm Normal file

Binary file not shown.

View File

@ -0,0 +1,23 @@
# Build steps for Plyr (3.6.8)
Tested on Hyperbola GNU with Linux-libre.
First install npm (node package manager).
Clone the repo to a location of your choosing:
```
git clone https://git.sr.ht/~heckyel/plyr
cd plyr
```
Install Plyr's dependencies:
```
npm install
```
Build with npm:
```
npm run build
```
plyr.js and other files will be in the `dist` directory.

1
extlib/plyr/plyr.css Normal file

File diff suppressed because one or more lines are too long

8678
extlib/plyr/plyr.js Normal file

File diff suppressed because it is too large Load Diff

2
extlib/plyr/plyr.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
extlib/plyr/plyr.min.mjs Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

8670
extlib/plyr/plyr.mjs Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2
extlib/plyr/plyr.polyfilled.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

1
extlib/plyr/plyr.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -52,12 +52,6 @@
;;; ./configure --without-virtualenv ;;; ./configure --without-virtualenv
;;; make ;;; make
;;; ;;;
;;; The devtools/update_extlib.sh script won't run on Guix due to missing
;;; "/usr/bin/env", so again for first time setup only, run:
;;;
;;; node node_modules/.bin/bower install
;;; ./devtools/update_extlib.sh
;;;
;;; For first time setup only with a regular `guix environment` or an ;;; For first time setup only with a regular `guix environment` or an
;;; `environment --pure`, but required EACH TIME you start an `environment ;;; `environment --pure`, but required EACH TIME you start an `environment
;;; --container` (because the generated profile goes away, breaking the links in ;;; --container` (because the generated profile goes away, breaking the links in

View File

@ -1,23 +1,25 @@
<script type="text/javascript" src="{{ <link href="{{ request.staticdirect('/extlib/plyr/plyr.css') }}" rel="stylesheet">
request.staticdirect('/extlib/video-js/video.js') }}"></script> <style>
{# Sadly commented out till we can get the mediagoblin skin ported over video {
# to the newest video.js release ;\ #} width: 100%;
{# }
<link href="{{ request.staticdirect('/css/vjs-mg-skin.css') }}" .responsive-container {
rel="stylesheet"> display: inline;
#} }
<link href="{{ /* plyr fix */
request.staticdirect('/extlib/video-js/video-js.css') }}" .plyr:-moz-full-screen video {
rel="stylesheet"> max-height: initial;
}
<style type="text/css"> .plyr:-webkit-full-screen video {
.vjs-default-skin .vjs-big-play-button max-height: initial;
{ }
top: 50%; .plyr:-ms-fullscreen video {
left: 50%; max-height: initial;
margin: -1.5em auto auto -2em; }
} .plyr:fullscreen video {
.vjs-play-progress, .vjs-volume-level { max-height: initial;
background-color: #86D4B1 !important; }
} .plyr video {
max-height: 360px;
}
</style> </style>

View File

@ -16,38 +16,68 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{% from "archivalook/utils/display_featured.html" import {% from "archivalook/utils/display_featured.html" import possibly_shortened_description %}
possibly_shortened_description %}
{%- set media = feature.media_entry %} {%- set media = feature.media_entry %}
{%- set display_media = request.app.public_store.file_url( {%- set display_media = request.app.public_store.file_url(
media.get_display_media()[1]) %} media.get_display_media()[1]) %}
{%- set entry_url = media.url_for_self(request.urlgen) %} {%- set entry_url = media.url_for_self(request.urlgen) %}
<div class="primary-feature"> <div class="primary-feature">
<a href="{{ entry_url }}"> <a href="{{ entry_url }}">
<p class="f-title">{{ media.title }}</p> <p class="f-title">{{ media.title }}</p>
</a> </a>
<div class="f-display"> <div class="f-display" id="player">
{%- set display_type, display_path = media.get_display_media() %} {%- set display_type, display_path = media.get_display_media() %}
<video controls <video controls playsinline
{% if global_config['plugins']['mediagoblin.media_types.video']['auto_play'] %}autoplay{% endif %} {% if global_config['plugins']['mediagoblin.media_types.video']['auto_play'] %}autoplay{% endif %}
preload="metadata" class="video-js vjs-default-skin"> preload="metadata" id="js-video-player">
<source src="{{ request.app.public_store.file_url(display_path) }}" <source src="{{ request.app.public_store.file_url(display_path) }}"
{% if media.media_data %} {% if media.media_data %}
type="{{ media.media_data.source_type() }}" type="{{ media.media_data.source_type() }}"
{% else %} {% else %}
type="{{ media.media_manager['default_webm_type'] }}" type="{{ media.media_manager['default_webm_type'] }}"
{% endif %} /> {% endif %} />
<div class="no_html5"> <div class="no_html5">
{%- trans -%}Sorry, this video will not work because {%- trans -%}Sorry, this video will not work because
your web browser does not support HTML5 your web browser does not support HTML5
video.{%- endtrans -%}<br/> video.{%- endtrans -%}<br/>
{%- trans -%}You can get a modern web browser that {%- trans -%}You can get a modern web browser that
can play this video at <a href="http://getfirefox.com"> can play this video at <a href="http://getfirefox.com">
http://getfirefox.com</a>!{%- endtrans -%} http://getfirefox.com</a>!{%- endtrans -%}
</div> </div>
</video> </video>
</div> </div>
{{ possibly_shortened_description(request, feature.media_entry) }} {{ possibly_shortened_description(request, feature.media_entry) }}
</div> </div>
<script src="{{ request.staticdirect('/extlib/plyr/plyr.js') }}"></script>
<script>
/* Fix plyr: If I set height on video element, fullscreen is broken */
let fluid_player = document.getElementById('player');
fluid_player.classList.add('responsive-container');
/* Playing */
const videoPlayer = new Plyr(document.getElementById('js-video-player'), {
disableContextMenu: false,
captions: {
active: true,
},
controls: [
'play-large',
'play',
'progress',
'current-time',
'duration',
'mute',
'volume',
'captions',
'settings',
'pip',
'airplay',
'fullscreen'
],
iconUrl: "{{ request.staticdirect('/extlib/plyr/plyr.svg') }}",
blankVideo: "{{ request.staticdirect('/extlib/plyr/blank.webm') }}",
debug: false
});
</script>

View File

@ -28,11 +28,11 @@
{%- else -%} {%- else -%}
<div class="secondary-feature aligned-left"> <div class="secondary-feature aligned-left">
{%- endif %} {%- endif %}
<div class="f-display"> <div class="f-display" id="player">
{%- set display_type, display_path = media.get_display_media() %} {%- set display_type, display_path = media.get_display_media() %}
<video controls <video controls playsinline
{% if global_config['plugins']['mediagoblin.media_types.video']['auto_play'] %}autoplay{% endif %} {% if global_config['plugins']['mediagoblin.media_types.video']['auto_play'] %}autoplay{% endif %}
preload="metadata" class="video-js vjs-default-skin"> preload="metadata" id="js-video-player">
<source src="{{ request.app.public_store.file_url(display_path) }}" <source src="{{ request.app.public_store.file_url(display_path) }}"
{% if media.media_data %} {% if media.media_data %}
type="{{ media.media_data.source_type() }}" type="{{ media.media_data.source_type() }}"
@ -54,3 +54,35 @@
<p class="f-title">{{ media.title }}</p> <p class="f-title">{{ media.title }}</p>
</a> </a>
</div> </div>
<!-- Plyr -->
<script src="{{ request.staticdirect('/extlib/plyr/plyr.js') }}"></script>
<script>
/* Fix plyr: If I set height on video element, fullscreen is broken */
let fluid_player = document.getElementById('player');
fluid_player.classList.add('responsive-container');
/* Playing */
const videoPlayer = new Plyr(document.getElementById('js-video-player'), {
disableContextMenu: false,
captions: {
active: true,
},
controls: [
'play-large',
'play',
'progress',
'current-time',
'duration',
'mute',
'volume',
'captions',
'settings',
'pip',
'airplay',
'fullscreen'
],
iconUrl: "{{ request.staticdirect('/extlib/plyr/plyr.svg') }}",
blankVideo: "{{ request.staticdirect('/extlib/plyr/blank.webm') }}",
debug: false
});
</script>

View File

@ -1 +1 @@
../../../extlib/leaflet/dist/ ../../../extlib/leaflet/dist

View File

@ -0,0 +1 @@
../../../extlib/plyr

View File

@ -1 +1 @@
../../../extlib/skeleton/ ../../../extlib/skeleton

View File

@ -1 +0,0 @@
../../../extlib/video.js/dist/

View File

@ -1 +0,0 @@
../../../extlib/videojs-resolution-switcher/lib/

View File

@ -19,92 +19,121 @@
{% extends 'mediagoblin/user_pages/media.html' %} {% extends 'mediagoblin/user_pages/media.html' %}
{% block mediagoblin_head -%} {% block mediagoblin_head -%}
{{ super() }} {{ super() }}
<script type="text/javascript" src="{{ <link href="{{ request.staticdirect('/extlib/plyr/plyr.css') }}" rel="stylesheet">
request.staticdirect('/extlib/video-js/video.js') }}"></script> <style>
<script type="text/javascript" src="{{ video {
request.staticdirect('/extlib/videojs-resolution-switcher/videojs-resolution-switcher.js') }}"> width: 100%;
</script> }
<script type="text/javascript" .responsive-container {
src="{{ request.staticdirect('/js/change-video-resolution.js') }}"></script> display: inline;
{# Sadly commented out till we can get the mediagoblin skin ported over }
# to the newest video.js release ;\ #} /* plyr fix */
<link href="{{ .plyr:-moz-full-screen video {
request.staticdirect('/extlib/video-js/video-js.css') }}" max-height: initial;
rel="stylesheet"> }
<link href="{{ .plyr:-webkit-full-screen video {
request.staticdirect('/extlib/videojs-resolution-switcher/videojs-resolution-switcher.css') }}" max-height: initial;
rel="stylesheet"> }
.plyr:-ms-fullscreen video {
<style type="text/css"> max-height: initial;
.vjs-default-skin .vjs-big-play-button }
{ .plyr:fullscreen video {
top: 50%; max-height: initial;
left: 50%; }
margin: -1.5em auto auto -2em; .plyr video {
} max-height: 360px;
.vjs-play-progress, .vjs-volume-level { }
background-color: #86D4B1 !important; </style>
}
</style>
{%- endblock %} {%- endblock %}
{% block mediagoblin_media %} {% block mediagoblin_media %}
<div class="media_other_container"> <div class="media_other_container" id="player">
{% set all_media_path = media.get_all_media() %} {% set all_media_path = media.get_all_media() %}
<video controls <video controls playsinline
{% if global_config['plugins']['mediagoblin.media_types.video']['auto_play'] %}autoplay{% endif %} {% if global_config['plugins']['mediagoblin.media_types.video']['auto_play'] %}autoplay{% endif %}
preload="metadata" class="video-js vjs-default-skin" id="video_1"> preload="metadata" id="js-video-player">
{% for each_media_path in all_media_path %} {% for each_media_path in all_media_path %}
<source src="{{ request.app.public_store.file_url(each_media_path[2]) }}" <source src="{{ request.app.public_store.file_url(each_media_path[2]) }}"
{% if media.media_data %} {% if media.media_data %}
type="{{ media.media_data.source_type() }}" type="{{ media.media_data.source_type() }}"
{% else %} {% else %}
type="{{ media.media_manager['default_webm_type'] }}" type="{{ media.media_manager['default_webm_type'] }}"
{% endif %} {% endif %}
label="{{ each_media_path[0] }}" res="{{ each_media_path[1][1] }}" /> data-res="{{ each_media_path[1][1] }}" />
{% endfor %} {% endfor %}
{%- for subtitle in media.subtitle_files %} {%- for subtitle in media.subtitle_files %}
<track src="{{ request.app.public_store.file_url(subtitle.filepath) }}" <track src="{{ request.app.public_store.file_url(subtitle.filepath) }}"
label="{{ subtitle.name }}" kind="subtitles"> label="{{ subtitle.name }}" kind="subtitles">
{%- endfor %} {%- endfor %}
<div class="no_html5"> <div class="no_html5">
{%- trans -%}Sorry, this video will not work because {%- trans -%}Sorry, this video will not work because
your web browser does not support HTML5 your web browser does not support HTML5
video.{%- endtrans -%}<br/> video.{%- endtrans -%}<br/>
{%- trans -%} {%- trans -%}
We recommend you install a <a href="https://libreplanet.org/wiki/Libre_Browsers_Libre_Formats">freedom-respecting browser which supports free formats</a>! We recommend you install a <a href="https://libreplanet.org/wiki/Libre_Browsers_Libre_Formats">freedom-respecting browser which supports free formats</a>!
{%- endtrans -%} {%- endtrans -%}
</div>
</video>
</div> </div>
</video>
</div> <!-- Plyr -->
<script src="{{ request.staticdirect('/extlib/plyr/plyr.js') }}"></script>
<script>
/* Fix plyr: If I set height on video element, fullscreen is broken */
let fluid_player = document.getElementById('player');
fluid_player.classList.add('responsive-container');
/* Playing */
const videoPlayer = new Plyr(document.getElementById('js-video-player'), {
disableContextMenu: false,
captions: {
active: true,
},
controls: [
'play-large',
'play',
'progress',
'current-time',
'duration',
'mute',
'volume',
'captions',
'settings',
'pip',
'airplay',
'fullscreen'
],
iconUrl: "{{ request.staticdirect('/extlib/plyr/plyr.svg') }}",
blankVideo: "{{ request.staticdirect('/extlib/plyr/blank.webm') }}",
debug: false
});
</script>
{% endblock %} {% endblock %}
{% block mediagoblin_sidebar %} {% block mediagoblin_sidebar %}
<h3>{% trans %}Download{% endtrans %}</h3> <h3>{% trans %}Download{% endtrans %}</h3>
<ul> <ul>
{% if 'original' in media.media_files %} {% if 'original' in media.media_files %}
<li> <li>
<a href="{{ request.app.public_store.file_url( <a href="{{ request.app.public_store.file_url(
media.media_files.original) }}"> media.media_files.original) }}" download>
{%- trans %}Original file{% endtrans -%} {%- trans %}Original file{% endtrans -%}
</a> </a>
</li> </li>
{% endif %} {% endif %}
{# Sorting will be wrong for resolutions >= 1000p as it's alphanumeric. #} {# Sorting will be wrong for resolutions >= 1000p as it's alphanumeric. #}
{% for name, media in media.media_files|dictsort|list %} {% for name, media in media.media_files|dictsort|list %}
{% if name.startswith('webm') %} {% if name.startswith('webm') %}
<li> <li>
<a href="{{ request.app.public_store.file_url(media) }}"> <a href="{{ request.app.public_store.file_url(media) }}" download>
{%- trans %}WebM file (VP8/Vorbis){% endtrans -%} {%- trans %}WebM file (VP8/Vorbis){% endtrans -%}
{{ name | replace('webm_', ' ') }} {{ name | replace('webm_', ' ') }}
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if 'webm_video' in media.media_files %} {% if 'webm_video' in media.media_files %}
{% endif %} {% endif %}
</ul> </ul>
{% endblock %} {% endblock %}