[PYTHON] Load a new media without resetting the player

This forum is about all development around libVLC.
Nepho
Blank Cone
Blank Cone
Posts: 16
Joined: 23 Mar 2015 01:50

[PYTHON] Load a new media without resetting the player

Postby Nepho » 01 Apr 2015 16:04

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.

Nepho
Blank Cone
Blank Cone
Posts: 16
Joined: 23 Mar 2015 01:50

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

Postby Nepho » 02 Apr 2015 20:07

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.

Nepho
Blank Cone
Blank Cone
Posts: 16
Joined: 23 Mar 2015 01:50

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

Postby Nepho » 05 Apr 2015 10:44

Still looking for an answer to that, if anyone knows anything about it :)

eayvh
New Cone
New Cone
Posts: 1
Joined: 05 Apr 2015 12:54

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

Postby eayvh » 05 Apr 2015 12:56

Create media list :wink:

Nepho
Blank Cone
Blank Cone
Posts: 16
Joined: 23 Mar 2015 01:50

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

Postby Nepho » 05 Apr 2015 13:21

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.

Nepho
Blank Cone
Blank Cone
Posts: 16
Joined: 23 Mar 2015 01:50

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

Postby Nepho » 09 Apr 2015 18:43

Still no one to help me?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 4 guests