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,8 +4,6 @@ packages:
- automake - automake
# - gcc # - gcc
# - make # - make
- nodejs
- npm
- python3-devel - python3-devel
- virtualenv - virtualenv

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

@ -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@
@ -82,7 +82,7 @@ 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
@ -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

@ -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

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') }}"
rel="stylesheet">
#}
<link href="{{
request.staticdirect('/extlib/video-js/video-js.css') }}"
rel="stylesheet">
<style type="text/css">
.vjs-default-skin .vjs-big-play-button
{
top: 50%;
left: 50%;
margin: -1.5em auto auto -2em;
} }
.vjs-play-progress, .vjs-volume-level { .responsive-container {
background-color: #86D4B1 !important; display: inline;
}
/* plyr fix */
.plyr:-moz-full-screen video {
max-height: initial;
}
.plyr:-webkit-full-screen video {
max-height: initial;
}
.plyr:-ms-fullscreen video {
max-height: initial;
}
.plyr:fullscreen video {
max-height: initial;
}
.plyr video {
max-height: 360px;
} }
</style> </style>

View File

@ -16,8 +16,7 @@
# 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(
@ -28,11 +27,11 @@
<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() }}"
@ -51,3 +50,34 @@
</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

@ -20,43 +20,40 @@
{% 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"
src="{{ request.staticdirect('/js/change-video-resolution.js') }}"></script>
{# Sadly commented out till we can get the mediagoblin skin ported over
# to the newest video.js release ;\ #}
<link href="{{
request.staticdirect('/extlib/video-js/video-js.css') }}"
rel="stylesheet">
<link href="{{
request.staticdirect('/extlib/videojs-resolution-switcher/videojs-resolution-switcher.css') }}"
rel="stylesheet">
<style type="text/css">
.vjs-default-skin .vjs-big-play-button
{
top: 50%;
left: 50%;
margin: -1.5em auto auto -2em;
} }
.vjs-play-progress, .vjs-volume-level { .responsive-container {
background-color: #86D4B1 !important; display: inline;
}
/* plyr fix */
.plyr:-moz-full-screen video {
max-height: initial;
}
.plyr:-webkit-full-screen video {
max-height: initial;
}
.plyr:-ms-fullscreen video {
max-height: initial;
}
.plyr:fullscreen video {
max-height: initial;
}
.plyr video {
max-height: 360px;
} }
</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 %}
@ -64,7 +61,7 @@
{% 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) }}"
@ -79,7 +76,39 @@
{%- endtrans -%} {%- endtrans -%}
</div> </div>
</video> </video>
</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>
{% endblock %} {% endblock %}
{% block mediagoblin_sidebar %} {% block mediagoblin_sidebar %}
@ -88,7 +117,7 @@
{% 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>
@ -97,7 +126,7 @@
{% 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>