Closed TRPB closed 4 years ago
Try with MPVJS_TERMINAL=1
MPVJS_VERBOSE=1
environment variables.
Thanks for the quick response!
MPVJS_TERMINAL=1 MPVJS_VERBOSE=1 npm run example
doesn't give me any additional output. I'm just using the example with the electron version set to 5.0.5 in package.json
. 4.2.5 didn't work either.
I'm assuming that the lack of additional output means it's not being loaded correctly.
The switch is being evaluated to build/Release/mpvjs.node;application/x-mpvjs
which looks correct and fs.existsSync('build/Release/mpvjs.node')
evalulates to true so it's not an issue with the path.
I did have to amend webPreferences
to include nodeIntegration
but that's to be expected.
Do you have console output for that command in case of electron 1.8.8?
Yes, I get a lot of console output. I'll paste it here but I don't think it's relevant:
MPVJS_TERMINAL=1 MPVJS_VERBOSE=1 npm run example
> mpv.js@0.3.0 example /home/tom/tmp/mpv2/mpv.js
> electron example
[cplayer] mpv 0.29.1 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
[cplayer] built on Fri Apr 19 20:49:51 UTC 2019
[cplayer] ffmpeg library versions:
[cplayer] libavutil 56.22.100
[cplayer] libavcodec 58.35.100
[cplayer] libavformat 58.20.100
[cplayer] libswscale 5.3.100
[cplayer] libavfilter 7.40.101
[cplayer] libswresample 3.3.100
[cplayer] ffmpeg version: n4.1.3
[cplayer]
[cplayer] Configuration: ./waf configure --prefix=/usr --confdir=/etc/mpv --enable-cdda --enable-dvb --enable-dvdnav --enable-libarchive --enable-libmpv-shared --enable-libsmbclient --enable-tv --enable-zsh-comp
[cplayer] List of enabled features: 52arch alsa asm atomics audio-input build-date caca cdda cplayer cplugins cuda-hwaccel debug-build drm drmprime dvbin dvdnav dvdread-common egl-drm egl-helpers egl-x11 fchmod ffmpeg ffnvcodec gbm gbm.h gl gl-wayland gl-x11 glibc-thread-name glob glob-posix gnuc gpl iconv jack jpeg lcms2 libaf libarchive libass libass-osd libav-any libavcodec libavdevice libbluray libdl libm libmpv-shared librt libsmbclient libv4l2 linux-fstatfs lua optimize oss-audio plain-gl posix posix-or-mingw posix-spawn posix-spawn-native pthreads pulse rubberband shaderc shaderc-shared stdatomic tv tv-v4l2 uchardet vaapi vaapi-drm vaapi-egl vaapi-glx vaapi-wayland vaapi-x-egl vaapi-x11 vdpau vdpau-gl-x11 videodev vt.h vulkan wayland wayland-protocols x11 xv zlib zsh-comp
[cplayer] Waiting for scripts...
[libmpv_render] GL_VERSION='OpenGL ES 2.0 Chromium'
[libmpv_render] Detected GLES 2.0.
[libmpv_render] GL_VENDOR='X.Org'
[ytdl_hook] script-opts/ytdl_hook.conf not found.
[ytdl_hook] lua-settings/ytdl_hook.conf not found.
[libmpv_render] GL_RENDERER='AMD Radeon VII (VEGA20, DRM 3.27.0, 5.0.13-arch1-1-ARCH, LLVM 8.0.0)'
[libmpv_render] GL_SHADING_LANGUAGE_VERSION='OpenGL ES GLSL ES 1.0 Chromium'
[libmpv_render] Loaded extension GL_EXT_unpack_subimage.
[libmpv_render] Loaded extension GL_EXT_texture_rg.
[libmpv_render] Loaded extension GL_EXT_color_buffer_half_float.
[libmpv_render] Function glQueryCounterEXT from extension GL_EXT_disjoint_timer_query not found.
[libmpv_render] Function glGetTranslatedShaderSourceANGLE from extension GL_ANGLE_translated_shader_source not found.
[stats] script-opts/stats.conf not found.
[stats] lua-settings/stats.conf not found.
[libmpv_render] GL_*_swap_control extension missing.
[libmpv_render] 16 bit UNORM textures not available.
[libmpv_render] Disabling HDR peak computation (one or more of the following is not supported: compute shaders=0, SSBO=0).
[libmpv_render] No advanced processing required. Enabling dumb mode.
[libmpv_render] Loading hwdec driver 'vaapi-egl'
[libmpv_render] Loading failed.
[libmpv_render] Loading hwdec driver 'cuda-nvdec'
[libmpv_render/cuda-nvdec] need OpenGL >= 2.1 or OpenGL-ES >= 3.0
[libmpv_render] Loading failed.
[libmpv_render] Loading hwdec driver 'vdpau-glx'
[libmpv_render] Loading failed.
[libmpv_render] Loading hwdec driver 'drmprime-drm'
[libmpv_render/drmprime-drm] Failed to retrieve DRM fd from native display.
[libmpv_render] Loading failed.
[cplayer] Done loading scripts.
[cplayer] Set property: hwdec="auto" -> 1
Playing: /home/tom/tmp/mpv2/mpv.js/example/tos.mkv
[cplayer] Running hook: ytdl_hook/on_load
[ytdl_hook] ytdl:// hook
[ytdl_hook] not a ytdl:// url
[ifo] Opening /home/tom/tmp/mpv2/mpv.js/example/tos.mkv
[ifo_dvdnav] Opening /home/tom/tmp/mpv2/mpv.js/example/tos.mkv
[bdmv/bluray] Opening /home/tom/tmp/mpv2/mpv.js/example/tos.mkv
[file] Opening /home/tom/tmp/mpv2/mpv.js/example/tos.mkv
[demux] Trying demuxers for level=normal.
[mkv] Found the head...
[mkv] + a segment...
[mkv] Parsing seek head...
[mkv] |+ segment information...
[mkv] | + muxing app: Lavf57.66.103
[mkv] | + writing app: Lavf57.66.103
[mkv] | + timecode scale: 1000000
[mkv] | + duration: 12.792s
[mkv] | + segment uid c2 63 12 89 d5 40 94 e9 d7 ed 97 7e ef 02 d5 16
[mkv] |+ segment tracks...
[mkv] | + a track...
[mkv] | + Track number: 1
[mkv] | + Track type: Video
[mkv] | + Video track
[mkv] | + Pixel width: 1280
[mkv] | + Pixel height: 534
[mkv] | + Codec ID: V_MPEG4/ISO/AVC
[mkv] | + CodecPrivate, length 39
[mkv] | + Language: eng
[mkv] | + Default duration: 41.667ms ( = 24.000 fps)
[mkv] | + a track...
[mkv] | + Track number: 2
[mkv] | + Track type: Audio
[mkv] | + Audio track
[mkv] | + Sampling frequency: 44100.000000
[mkv] | + Bit depth: 16
[mkv] | + Channels: 2
[mkv] | + Codec ID: A_MPEG/L3
[mkv] | + Language: eng
[mkv] | + a track...
[mkv] | + Track number: 3
[mkv] | + Track type: Subtitle
[mkv] | + Codec ID: S_TEXT/UTF8
[mkv] | + Language: und
[mkv] |+ found cluster
[mkv] Deferring reading cues.
[mkv] All headers are parsed!
[demux] Detected file format: Matroska
[cplayer] Opening done: /home/tom/tmp/mpv2/mpv.js/example/tos.mkv
[cplayer] Running hook: ytdl_hook/on_preloaded
[mkv] select track 0
[mkv] select track 1
[mkv] select track 2
(+) Video --vid=1 (*) (h264 1280x534 24.000fps)
(+) Audio --aid=1 --alang=eng (*) (mp3 2ch 44100Hz)
(+) Subs --sid=1 (*) (subrip)
[vd] Container reported FPS: 24.000000
[vd] Codec list:
[vd] h264 - H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
[vd] h264_v4l2m2m (h264) - V4L2 mem2mem H.264 decoder wrapper
[vd] h264_cuvid (h264) - Nvidia CUVID H264 decoder
[vd] Opening decoder h264
[vd] Looking at hwdec h264-nvdec...
[vd] Could not create device.
[vd] Looking at hwdec h264-vdpau...
[vd] Could not create device.
[vd] Looking at hwdec h264-vaapi...
[vd] Could not create device.
[vd] Looking at hwdec h264-nvdec-copy...
[ffmpeg] AVHWDeviceContext: Cannot load libcuda.so.1
[ffmpeg] AVHWDeviceContext: Could not dynamically load CUDA
[vd] Could not create device.
[vd] Looking at hwdec h264-vdpau-copy...
[vd] Trying hardware decoding via h264-vdpau-copy.
[vd] Pixel formats supported by decoder: vdpau cuda vaapi_vld yuv420p
[vd] Codec profile: Main (0x4d)
[vd] Requesting pixfmt 'vdpau' from decoder.
[vd] Selected codec: h264 (H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10)
[vf] User filter list:
[vf] (empty)
[ad] Codec list:
[ad] mp3float (mp3) - MP3 (MPEG audio layer 3)
[ad] mp3 - MP3 (MPEG audio layer 3)
[ad] Opening decoder mp3float
[ad] Requesting 1 threads for decoding.
[ad] Selected codec: mp3float (MP3 (MPEG audio layer 3))
[af] User filter list:
[af] (empty)
[sub/ass] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 2.5.1 (COMPLEX)
[sub/ass] Setting up fonts...
[sub/ass] Using font provider fontconfig
[sub/ass] Done.
[cplayer] Starting playback...
[vd] Pixel formats supported by decoder: vdpau cuda vaapi_vld yuv420p
[vd] Codec profile: Main (0x4d)
[vd] Requesting pixfmt 'vdpau' from decoder.
Using hardware decoding (vdpau-copy).
[vd] Decoder format: 1280x534 nv12 auto/auto/auto/auto/auto CL=mpeg2/4/h264 (auto 0.000000/0.000000/0.000000)
[vd] Using container aspect ratio.
[vf] [in] 1280x534 nv12 bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [userdeint] 1280x534 nv12 bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [userdeint] (disabled)
[vf] [autorotate] 1280x534 nv12 bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [autorotate] (disabled)
[vf] [convert] 1280x534 nv12 bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [convert] (disabled)
[vf] [out] 1280x534 nv12 bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[af] [in] 44100Hz stereo 2ch floatp
[af] [userspeed] 44100Hz stereo 2ch floatp
[af] [userspeed] (disabled)
[af] [convert] 44100Hz stereo 2ch floatp
[ao] Trying audio driver 'pulse'
[ao/pulse] requested format: 44100 Hz, stereo channels, floatp
[ao/pulse] Library version: 12.2.0
[ao/pulse] Proto: 32
[ao/pulse] Server proto: 4294967295
[ao/pulse] Channel layouts:
[ao/pulse] - #fl
[ao/pulse] - #fr
[ao/pulse] - #fc
[ao/pulse] - #lfe
[ao/pulse] - #bl
[ao/pulse] - #br
[ao/pulse] - #flc
[ao/pulse] - #frc
[ao/pulse] - #bc
[ao/pulse] - #sl
[ao/pulse] - #sr
[ao/pulse] - #tc
[ao/pulse] - #tfl
[ao/pulse] - #tfc
[ao/pulse] - #tfr
[ao/pulse] - #tbl
[ao/pulse] - #tbc
[ao/pulse] - #tbr
[ao/pulse] result: stereo
[ao/pulse] device buffer: 4410 samples.
[ao/pulse] using soft-buffer of 8820 samples.
AO: [pulse] 44100Hz stereo 2ch float
[cplayer] AO: Description: PulseAudio audio output
VO: [libmpv] 1280x534 nv12
[cplayer] VO: Description: render API for libmpv
[vo/opengl-cb] reconfig to 1280x534 nv12 bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[libmpv_render] Window size: 3828x2065
[libmpv_render] Video source: 1280x534 (1:1)
[libmpv_render] Video display: (0, 0) 1280x534 -> (0, 234) 3828x1596
[libmpv_render] Video scale: 2.990625/2.988764
[libmpv_render] OSD borders: l=0 t=234 r=0 b=235
[libmpv_render] Video borders: l=0 t=234 r=0 b=235
[libmpv_render] Texture for plane 0: 1280x534
[libmpv_render] Texture for plane 1: 640x267
[libmpv_render] No advanced processing required. Enabling dumb mode.
[cplayer] first video frame after restart shown
[autoconvert] inserting resampler
[swresample] format change, reinitializing resampler
[swresample] 44100Hz stereo floatp -> 44100Hz stereo float
[af] [out] 44100Hz stereo 2ch float
[cplayer] starting audio playback
[cplayer] playback restart complete
(Paused) AV: 00:00:00 / 00:00:12 (0%) A-V: 0.000
On 5.0.5 or 4.2.5 I get no additional output,.
One thing that may be relevant is when I switch to 5.0.5 I get the following fatal error:
[67610:0623/213608.540274:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/tom/tmp/mpv2/mpv.js/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.
While that's not the cause, and following the instructions fixes it, I'd imagine the sandbox mode may affect plugin loading.
edit: In the browser navigator.plugins[0].enabledPlugin[0]
contains this:
description: ""
filename: "mpvjs.node"
length: 1
name: "mpvjs.node"
So chromium is definitely seeing the register-pepper-plugins
switch.
This might be the problem: https://github.com/Kagami/mpv.js#libmpv-is-being-linked-with-electrons-libffmpeg-on-linux
I did require that for 1.8.8, unfortunately on 5.0.5 it makes no difference. Could it be an ffmpeg problem?
A long shot but I tried libffmpeg.so from 1.8.8 in 5.0.5 and it didn't work.
On a fresh install using 1.8.8 without the libffmpeg.so fix I do see console output from the debug flags:
[cplayer] mpv 0.29.1 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
[cplayer] built on Fri Apr 19 20:49:51 UTC 2019
[cplayer] ffmpeg library versions:
[cplayer] libavutil 56.22.100 (runtime 55.47.101)
[cplayer] libavcodec 58.35.100 (runtime 57.82.100)
[cplayer] libavformat 58.20.100 (runtime 57.66.103)
[cplayer] libswscale 5.3.100
[cplayer] libavfilter 7.40.101
[cplayer] libswresample 3.3.100
[cplayer] ffmpeg version: N-84439-gee0678817d
[cplayer]
[cplayer] Configuration: ./waf configure --prefix=/usr --confdir=/etc/mpv --enable-cdda --enable-dvb --enable-dvdnav --enable-libarchive --enable-libmpv-shared --enable-libsmbclient --enable-tv --enable-zsh-comp
[cplayer] List of enabled features: 52arch alsa asm atomics audio-input build-date caca cdda cplayer cplugins cuda-hwaccel debug-build drm drmprime dvbin dvdnav dvdread-common egl-drm egl-helpers egl-x11 fchmod ffmpeg ffnvcodec gbm gbm.h gl gl-wayland gl-x11 glibc-thread-name glob glob-posix gnuc gpl iconv jack jpeg lcms2 libaf libarchive libass libass-osd libav-any libavcodec libavdevice libbluray libdl libm libmpv-shared librt libsmbclient libv4l2 linux-fstatfs lua optimize oss-audio plain-gl posix posix-or-mingw posix-spawn posix-spawn-native pthreads pulse rubberband shaderc shaderc-shared stdatomic tv tv-v4l2 uchardet vaapi vaapi-drm vaapi-egl vaapi-glx vaapi-wayland vaapi-x-egl vaapi-x11 vdpau vdpau-gl-x11 videodev vt.h vulkan wayland wayland-protocols x11 xv zlib zsh-comp
ffmpeg library versions:
libavutil 56.22.100 (runtime 55.47.101)
libavcodec 58.35.100 (runtime 57.82.100)
libavformat 58.20.100 (runtime 57.66.103)
libswscale 5.3.100
libavfilter 7.40.101
libswresample 3.3.100
ffmpeg version: N-84439-gee0678817d
mpv was compiled against a different version of FFmpeg/Libav than the shared
library it is linked against. This is most likely a broken build and could
result in misbehavior and crashes.
mpv does not support this configuration and will not run - rebuild mpv instead.
[cplayer] Waiting for scripts...
mpv init failed
[main] Exiting...
[stats] script-opts/stats.conf not found.
[ytdl_hook] script-opts/ytdl_hook.conf not found.
[ytdl_hook] lua-settings/ytdl_hook.conf not found.
[stats] lua-settings/stats.conf not found.
[cplayer] Done loading scripts.
[stats] Exiting...
[ytdl_hook] Exiting...
This error is fixed with the gcc -Wl,--no-as-needed -shared -lavformat -o node_modules/electron/dist/libffmpeg.so
command. That I'm not seeing any output in the console with 5.0.5 suggests that it's not even getting as far as loading libffmpeg.so
I think I've found the issue: https://developer.chrome.com/native-client
(P)NaCl Deprecation Announcements
Given the momentum of cross-browser WebAssembly support, we plan to focus our native code efforts on WebAssembly going forward and plan to remove support for PNaCl in Q2 2019 (except for Chrome Apps). We believe that the vibrant ecosystem around WebAssembly makes it a better fit for new and existing high-performance web apps and that usage of PNaCl is sufficiently low to warrant deprecation.
I guess now we're in Q2 it's been removed. That's very frustrating. Could this plugin even be created with WebAssembly? My app will forever be on an older electron version then.
except for Chrome Apps
I thought electron utilizes pnacl feature as a chrome app. Need to check though.
Could this plugin even be created with WebAssembly?
Technically possible but decoding would be much slower than now and hwdec isn't possible at all.
I thought electron utilizes pnacl feature as a chrome app. Need to check though.
https://developer.chrome.com/native-client/migration
The page also says "We also recently announced the deprecation Q1 2018 of Chrome Apps outside of ChromeOS."
I guess we're stuck on older versions of Electron unless Electron re-enables support, though I'd imagine that would become increasingly difficult as Chromium develops upstream.
Electron v4.2.9 work fine with mpv.js.
I've tried to use Electron v6.0.1 with origin trials for Portable Native Client enabled for my site. The result is MPV onReady event registered and plugin loaded, but video still not played.Still need more trial & error.
Just want to let you know that this issue can be fixed by adding this switch:
electron.app.commandLine.appendSwitch('no-sandbox');
According to this issue: electron/electron#18516
I tried electron 5.0.12, it works.
Work with latest electron 7.1.2 too. Thanks.
Just want to let you know that this issue can be fixed by adding this switch:
electron.app.commandLine.appendSwitch('no-sandbox');
According to this issue: electron/electron#18516
I tried electron 5.0.12, it works.
Update: work with latest electron 8.1.1 This issue should be closed.
Closing in favor of #64.
Just want to let you know that this issue can be fixed by adding this switch:
electron.app.commandLine.appendSwitch('no-sandbox');
According to this issue: electron/electron#18516
I tried electron 5.0.12, it works.
This has fixed my issue with flash not playing when outside of the asar package in electron-builder.
While the example code with Electron 1.8.8 woks great, as soon as I upgrade the electron version I get "Couldn't load plugin".
Is there something else I need to do to get it working? I've re-run
npm install
and there's nothing in the terminal or browser dev tools console. It appears innavigator.plugins
in the browser.