diff --git a/Makefile b/Makefile index 036139d..52ad49c 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,47 @@ -.PHONY: all depend css src +.PHONY: \ + all \ + depend \ + depend-mediaelement \ + depend-mediaelement-plugins \ + depend-node \ + css \ + src \ + test -all: depend css src +all: \ + depend \ + css \ + src -depend: +depend: \ + depend-node \ + depend-mediaelement \ + depend-mediaelement-plugins + +depend-mediaelement: + @echo "Preparing dependency \"mediaelement\" ..." + git -C mediaelement reset --hard HEAD + patch -d mediaelement -p1 < patches/mediaelement/01-iconsprite.diff + cd mediaelement && grunt + +depend-mediaelement-plugins: + @echo "Preparing dependency \"mediaelement-plugins\" ..." + git -C mediaelement-plugins reset --hard HEAD patch -d mediaelement-plugins -p1 < patches/mediaelement-plugins/01-playlist.js.diff + cd mediaelement-plugins && grunt + +depend-node: + @echo "Installing required NodeJS dependencies ..." + npm install css: + @echo "Building CSS ..." css/build.sh + src: + @echo "Building Javascript ..." src/build.sh + +test: + @echo "Performing tests ..." + npm test diff --git a/css/build.sh b/css/build.sh index 2167176..bc3e1c0 100755 --- a/css/build.sh +++ b/css/build.sh @@ -24,17 +24,13 @@ else echo "INFO: Minimized CSS to $cssdir/myplayer.min.css" >&2 - for svg in \ - ../mediaelement-plugins/dist/playlist/playlist-controls.svg \ - ../mediaelement/build/mejs-controls.svg - do - svg_out="$cssdir/$(basename "$svg")" + svg=../mediaelement-plugins/dist/playlist/playlist-controls.svg + svg_out="$cssdir/$(basename "$svg")" - if ! cp "$svg" "$svg_out" ; then - echo "ERROR: Copying controls SVG $svg failed; aborted." >&2 - exit 1 - else - echo "INFO: Copied controls SVG to $svg_out" >&2 - fi - done + if ! cp "$svg" "$svg_out" ; then + echo "ERROR: Copying controls SVG $svg failed; aborted." >&2 + exit 1 + else + echo "INFO: Copied controls SVG to $svg_out" >&2 + fi fi diff --git a/patches/mediaelement/01-iconsprite.diff b/patches/mediaelement/01-iconsprite.diff new file mode 100644 index 0000000..1004f20 --- /dev/null +++ b/patches/mediaelement/01-iconsprite.diff @@ -0,0 +1,9 @@ +--- a/src/js/utils/generate.js 2024-11-10 02:15:40.851022011 +0100 ++++ b/src/js/utils/generate.js 2024-11-12 02:23:10.833246352 +0100 +@@ -48,5 +48,5 @@ + const iconHtml = icons.map(icon => { + return ` + ` }) diff --git a/src/player.js b/src/player.js index a6ba9ed..881b595 100644 --- a/src/player.js +++ b/src/player.js @@ -181,7 +181,7 @@ var MyPlayer = function(_args) { } }, createPlayer = function() { - player = new MediaElementPlayer( + player = new MediaElementPlayer( "myplayer", { success: playerCreated, features: [ @@ -196,13 +196,16 @@ var MyPlayer = function(_args) { 'shuffle', 'loop' ] - }); + } + ); $(args.element).append( '
' ); + + $(args.element).append(iconSprite); }, param = function(name) { var query = window.location.search.substring(1); @@ -443,5 +446,74 @@ var MyPlayer = function(_args) { $(args.element).append(`Unsupported mode ${args.mode}"
`); failed = true; } + + var iconSprite = ` +`; };