Page 1 of 1

[PYTHON] Load a new media without resetting the player

Posted: 01 Apr 2015 16:04
by Nepho
Hi,

Whenever I want to change the played video, I do:

Code: Select all

player.set_media(instance.media_new("path/to/media") player.play()
However, what bothers me is that player.play() sometimes closes the current VLC instance and opens a new one, usually with a different size/video resolution.

This really bothers me because I need to keep the focus on one specific VLC instance, and this messes up my thing.

Any way to make sure it won't restart/load a new VLC instance when I change a media? Thanks in advance.

Re: [PYTHON] Load a new media without resetting the player

Posted: 02 Apr 2015 20:07
by Nepho
Anyone to help me?

I'd just like the new media to always be opened in the same VLC window.
Because right now, sometimes, it closes the old one and opens a new one, which
makes my other software lose the focus on the VLC window.

Please? It can't be hard.

Edit: A bit more of the code.

Code: Select all

import vlc, time i = vlc.Instance() player = i.media_player_new() player.set_media(i.media_new("path/to/media") player.play() time.sleep(5) player.set_media(i.media_new("path/to/other/media") # The media has different resolution and encoding player.play() # If I don't put this, the old media will just freeze and nothing happens time.sleep(5)
And this is at the second play() call that the VLC window will sometimes close, and re-open for the new media, which causes my other program to lose the focus on it.

I don't really know what are the reasons behind this. I don't think it has something to do with the video's resolution. It might be the encoding, because I don't think the container has something to do with it either.

Re: [PYTHON] Load a new media without resetting the player

Posted: 05 Apr 2015 10:44
by Nepho
Still looking for an answer to that, if anyone knows anything about it :)

Re: [PYTHON] Load a new media without resetting the player

Posted: 05 Apr 2015 12:56
by eayvh
Create media list :wink:

Re: [PYTHON] Load a new media without resetting the player

Posted: 05 Apr 2015 13:21
by Nepho
The media list object is bugged, I already filled a ticket for this about one week ago.
When you add medias to the playlist, it can cause a access violation error, more or less randomly. Well, it looks random at least.
Plus, for some reason, with a MediaListPlayer, you can't access any information about the media being played...
Or can you? I'm all ears!

Edit: The fact that I can't create playlists with the Python bindings isn't that a big problem, since I can always create them in VLC
before using my program, but the rest of the problems (can't access name of currently played media) really sucks.

Re: [PYTHON] Load a new media without resetting the player

Posted: 09 Apr 2015 18:43
by Nepho
Still no one to help me?