video stops when setting position or time

This forum is about all development around libVLC.
daSpud99
New Cone
New Cone
Posts: 6
Joined: 08 Apr 2019 12:15

video stops when setting position or time

Postby daSpud99 » 08 Apr 2019 12:29

I have a very simple player written in WinDev using the API calls. It works just fine until I try to setPosition or setTime. The video just stops and will not resume.

I can pause and resume the playing. Say I have a 10 minute video and I set position to .5. The getTime will return 300000 (or 5 minutes), but the video does not move. I can set the position to .25 and the getTime will return 150000 and the video will not move.

The IsPlaying indicator is always returning 0 even if the video is playing on the screen. also I did libvlc_video_set_key_input but the keys do not work to change the position being played. Also libvlc_media_player_is_seekable=1

I appreciate any suggestions as to what might be wrong or if there is another approach to being able to control the video. Thank you.

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: video stops when setting position or time

Postby mfkl » 08 Apr 2019 15:05

Are you calling libvlc in a libvlc callback?
https://mfkl.github.io

fossette
Blank Cone
Blank Cone
Posts: 12
Joined: 06 Apr 2019 16:26
Operating System: FreeBSD
Contact:

Re: video stops when setting position or time

Postby fossette » 08 Apr 2019 18:24

Are you calling libvlc in a libvlc callback?
Important question indeed!

Personally I try to avoid any processing in calback functions and threads, just set binary variables picked up by the main process.

From my experience, the libvlc_media_player_get_position() didn't give good results, always 0 too, but that's probably just me where I was familiarizing myself with the LibVLC library. Now, I only use libvlc_media_player_get_time() because it's more precise, and works beautifully.

All that being said, perhaps you fell into an undocumented/unhighlighted fact that when you call libvlc_media_player_play() for the first time, the video may not play or even exist when the play function returns. Results to call to libvlc_media_player_get_position() are irrelevant at that precise moment, and to the moment that the video actually plays. My work arround is to call sleep(1), that's a 1 second pause to enable the LibVLC thread to begin its work.

Food for thoughts! :D

daSpud99
New Cone
New Cone
Posts: 6
Joined: 08 Apr 2019 12:15

Re: video stops when setting position or time

Postby daSpud99 » 09 Apr 2019 00:39

Thank you for the replies. I don't know what "callback" is so I doubt I am using it. I was just following the sample

I was using both gettime and getposition to see what's what. Settime will move the time to the specified value (and gettime shows that), but the video will not play.

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: video stops when setting position or time

Postby mfkl » 09 Apr 2019 08:30

Have no idea what sample you're referring to (there are quite a few on the internetz). Please share full code.
https://mfkl.github.io

daSpud99
New Cone
New Cone
Posts: 6
Joined: 08 Apr 2019 12:15

Re: video stops when setting position or time

Postby daSpud99 » 11 Apr 2019 07:34

The sample code is found here. https://wiki.videolan.org/LibVLC_Tutorial I am using WinDev and API calls modeled after that sample and that works OK.

Now I want to do a bit more like be able to navigate with the keyboard and influence the position in the playing according to my own logic, but that does not seem to be working as the video just stops playing when I use settime or setposition.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 27 guests