Giter Club home page Giter Club logo

Comments (20)

Cimbali avatar Cimbali commented on June 14, 2024

The version is in the 'help > about' menu.

It seems the video is playing but is not embedded. There seem to be a limited number of interfaces in libvlc to do this: hwnd (Windows window handle), xwindow (X11 window id), nsobject (an "NSView" handler, from Apple though i don't know if it is Mac OS or iPhone) and agl (I don't know what this one is).

XQuartz seems to be an X11 implementation so hopefully we can still use the xwindow interface though we'll need to get the window id some other way.

from pympress.

ekrimsk avatar ekrimsk commented on June 14, 2024

I don't see any help button I can click on. I am starting the program with

python3 /usr/local/lib/python3.6/site-packages/pympress

but I think it is version 1.1.2 judging from the following directory on my machine: /usr/local/lib/python3.6/site-packages/pympress-1.1.2.dist-info/

There may be some way for me to download an older X11 implementation and use that so I can still use the xwindow interface (I'm really new to python so my apologies if this makes no sense)

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

The help menu is in the top right corner of the "presenter" window, so the one with the clocks etc. 1.1.2 is the latest version.

Don't worry about not making sense, I don't have a Mac so I'm pretty lost here too.

If you run xdotool getmouselocation, is there a window id?

from pympress.

ekrimsk avatar ekrimsk commented on June 14, 2024

Again, very new to python, where/how do I run xdotool getmouselocation and check for a window ID?

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

it's a shell command, try running it in a terminal, not in python. You can also try running xwininfo and clicking a window.

from pympress.

ekrimsk avatar ekrimsk commented on June 14, 2024

Ah, I had to install xdotool. Running xdotool getmouselocation gives me

'Warning: XTEST extension unavailable on '(null)'. Some functionality may be disabled; See 'man xdotool' for more info.
x:720 y:439 screen:0 window:417'
And this seems to be the case no matter where my mouse is or which window it is over.

Trying xwininfo in the shell gives me
xwininfo: Please select the window about which you would like information by clicking the mouse in that window.
And starts XQuartz however clicking does not seem to give me any output

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

This seems harder than planned, as both approaches currently considered for video playback require the X11 id of the window, which I can’t seem to find on macOS / XQuartz. For now there will be no video support on mac, until such time as I can devise a workaround.

I’m thinking of building a full gstreamer pipeline in pympress rather than relying on gstplayer (which is not available in homebrew), see if that helps the stability of the gstreamer backend and whether it allows to avoid this issue of X11 ids, as presumably we would then be able to use the video directly in/as a widget.

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

So Gstreamer pipelines have the same drawback and I know of no way to get around this issue. Video support on macOS is postponed until I figure out how to embed video in windows on this platform.

I’ve also tried having a look around other portable Gtk apps that embed videos to see how they do it, but so far none of them seem to support videos on macOS either.

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

NSView* is the id I was looking for, not the X11 ids. Easier to fix when knowing what to look for.

If anyone on macOS can confirm that the branch feature/xquartz_vlc works − my limited testing seems to confirm that pympress + VLC now successfully plays videos embedded in PDFs.

from pympress.

adamliter avatar adamliter commented on June 14, 2024

I just tried it out with an example that uses the package multimedia, and it worked to play the video. For example:

\documentclass{beamer}
\usepackage{multimedia}
\begin{document}
\begin{frame}
   \movie[]{video}{video.mp4}
\end{frame}
\end{document}

I clicked on the text "video", and it started playing the video. When I did this, the video took over with a full screen display. I'm not sure if this is the intended behavior or not, but I was expecting the video to play inside its container on the slide, rather than taking over the full screen.

(I should say that I'm not super familiar with multimedia; I've always used media9 in the past, but media9 doesn't seem to work with pympress.)

Moreover, I wasn't able to do anything while the video was playing. I couldn't pause it, for example, which I was expecting to be able to do, but perhaps this is the intended behavior? (It also doesn't seem to respect the option showcontrols=true for the \movie command from the multimedia package.)

And finally, this is perhaps an edge case, but if the video stops playing when the OS-level app focus is on something other than pympress's running Python process (e.g., if the OS-level focus is on this browser window that I'm using to write this comment when the video finishes), when I switch back to pympress's running Python process, none of the controls work anymore. I cannot advance to the next slide, I cannot pause or reset the timer. I just can't do anything. Switching the focus away is obviously not something you'd do when actually giving a presentation, but it could be inconvenient when you're practicing the presentation.

But if the video finishes playing when the OS-level focus is still on pympress's running Python process, then everything works just fine.

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

Ah thanks a lot for the feedback @adamliter ! So still some work to be done then. I’m afraid testing with virtual machines is not really enough for this kind of problems so I’m pretty limited.

The intended behaviour is like on Linux and Windows:

  • the video shows in the dedicated area, which is set in the \movie options
  • controls are shown on the presenter window regardless of showcontrols=true (and I think never on the content window though that should respect the option)

My typical \movie test command looks like:

\movie[width=0.9\textwidth]{\includegraphics[width=0.9\textwidth]{frame1.png}}{test.mp4}

Then the image should be replaced by the video area, which works best if they have the same aspect ratio.

Could you post the log that corresponds to your test? It should be in ~/Library/Logs/pympress.log. I’m interested in the versions of software/dependencies (the line that starts with INFO:pympress.__main__:Pympress: 1.5.0+b4@6 or something similar) and any errors messages that follow.

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

I suppose the python-vlc test script for gtk would not work either, then? it is available here: https://raw.githubusercontent.com/Cimbali/python-vlc/be090f1/examples/gtkvlc.py

from pympress.

adamliter avatar adamliter commented on June 14, 2024

This is the content of ~/Library/Logs/pympress.log:

ERROR:pympress.extras:Video support using GStreamer is disabled.
Traceback (most recent call last):
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/pympress/extras.py", line 408, in _setup_backends
    from pympress.media_overlays.gst_backend import GstOverlay
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/pympress/media_overlays/gst_backend.py", line 35, in <module>
    gi.require_version('Gst', '1.0')
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gst not available
INFO:pympress.__main__:Pympress: 1.4.1 ; Python: 3.7.3 ; OS: Darwin 18.7.0 ; Gtk 3.24.12 ; GLib 2.62.0 ; Poppler 0.81.0 cairo ; Cairo 1.16.0 , pycairo 1.18.2 ; Media: GtkImage gif player, VLC 3.0.8 Vetinari
WARNING:pympress.document:Pympress can not interpret annotation of type: <enum POPPLER_ANNOT_UNKNOWN of type Poppler.AnnotType> 
WARNING:pympress.document:Pympress can not interpret annotation of type: <enum POPPLER_ANNOT_WIDGET of type Poppler.AnnotType> 
ERROR:pympress.extras:Video support using GStreamer is disabled.
Traceback (most recent call last):
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/pympress/extras.py", line 408, in _setup_backends
    from pympress.media_overlays.gst_backend import GstOverlay
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/pympress/media_overlays/gst_backend.py", line 35, in <module>
    gi.require_version('Gst', '1.0')
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gst not available
INFO:pympress.__main__:Pympress: 1.4.1 ; Python: 3.7.3 ; OS: Darwin 18.7.0 ; Gtk 3.24.12 ; GLib 2.62.0 ; Poppler 0.81.0 cairo ; Cairo 1.16.0 , pycairo 1.18.2 ; Media: GtkImage gif player, VLC 3.0.8 Vetinari
ERROR:pympress.ui:ERROR: missing command "cancel" for Escape
ERROR:pympress.ui:ERROR: missing command "cancel" for Escape
ERROR:pympress.extras:Video support using GStreamer is disabled.
Traceback (most recent call last):
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/pympress/extras.py", line 408, in _setup_backends
    from pympress.media_overlays.gst_backend import GstOverlay
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/pympress/media_overlays/gst_backend.py", line 35, in <module>
    gi.require_version('Gst', '1.0')
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gst not available
INFO:pympress.__main__:Pympress: 1.4.1 ; Python: 3.7.3 ; OS: Darwin 18.7.0 ; Gtk 3.24.12 ; GLib 2.62.0 ; Poppler 0.81.0 cairo ; Cairo 1.16.0 , pycairo 1.18.2 ; Media: GtkImage gif player, VLC 3.0.8 Vetinari
ERROR:pympress.extras:Video support using GStreamer is disabled.
Traceback (most recent call last):
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/pympress/extras.py", line 408, in _setup_backends
    from pympress.media_overlays.gst_backend import GstOverlay
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/pympress/media_overlays/gst_backend.py", line 35, in <module>
    gi.require_version('Gst', '1.0')
  File "/Users/adamliter/.pyenv/versions/3.7.3/envs/pympress-dev/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gst not available
INFO:pympress.__main__:Pympress: 1.4.1 ; Python: 3.7.3 ; OS: Darwin 18.7.0 ; Gtk 3.24.12 ; GLib 2.62.0 ; Poppler 0.81.0 cairo ; Cairo 1.16.0 , pycairo 1.18.2 ; Media: GtkImage gif player, VLC 3.0.8 Vetinari

If I try to play a video using that I script, I get the following message:

tmp.py:40: DeprecationWarning: Gdk.threads_init is deprecated
  Gdk.threads_init ()
tmp.py:124: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "stock_id" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
  b = Gtk.ToolButton(i, text)
Traceback (most recent call last):
  File "tmp.py", line 84, in handle_embed
    gdkdll = ctypes.CDLL('libgdk-3.0.dll')
  File "/Users/adamliter/.pyenv/versions/3.7.3/lib/python3.7/ctypes/__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libgdk-3.0.dll, 6): image not found

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

The missing Gst namespace error is expected, I guess I could remove it from the output. The VLC bindings seems to load correctly as it returns the VLC version correctly.

On the test script, macOS libraries should be .dylib not .dll, sorry about that (and quartz not quaerz on the next line). Try the updated version:
https://raw.githubusercontent.com/Cimbali/python-vlc/master/examples/gtkvlc.py

from pympress.

adamliter avatar adamliter commented on June 14, 2024

With the updated script, I'm now seeing this message:

tmp.py:40: DeprecationWarning: Gdk.threads_init is deprecated
  Gdk.threads_init ()
tmp.py:124: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "stock_id" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
  b = Gtk.ToolButton(i, text)

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

Great, so only some warnings. Does it open a window with controls in which a video can be played? Say if you run python3 tmp.py video.mp4 ?

from pympress.

adamliter avatar adamliter commented on June 14, 2024

No. A window does open, but it's just a blank window:

image

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

Looking for contributors/PRs to unblock this issue. I’m afraid I don’t have a macOS machine to work on this myself, and my virtual machine setup does not have hardware acceleration so I can’t test anything video-related.

A good start would be to get this gtk+vlc test script (same as above) to show videos in a window − in theory it does what it should, that is pass a NSObject* (instead of a X window id) to the VLC plugin.

Once we know what’s needed to make videos work on macOS, we can port this solution to the pympress code.

If any other video player with python bindings make this easier, we can make a different video backend. Again, a demo of a gtk widget embedding a video would be a good start.

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

Current master should work on macOS, using the gst backend. Steps to try it out:

  1. update pympress with brew install pympress --head
  2. ensure the gtksink plugin from gstreamer is installed with some test file gst-play-1.0 --videosink gtksink test.avi (should work without warnings)
    • otherwise install dependencies with brew install gstreamer gst-plugins-good
  3. check enabled = on under [gst] in the preferences file located at ~/Library/Preferences/pympress

from pympress.

Cimbali avatar Cimbali commented on June 14, 2024

Closing as the feature is implemented. If not working, open a new bug with debugging details (including the 3 steps above).

from pympress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.