How to quit in Rpi CLI
Posted: 01 Dec 2024 00:56
Hi All
Originally posted here:[url][https://forum.videolan.org/viewtopic.ph ... 165660/url]
But after graduating to using the library, thought this the better place.
Using a Rpi Zero W 2 booting directly to cli as a headless system.
In other words X is not loaded.
Then in /etc/rc.local I start my app.
This app is developed in FreeBasic and uses libvlc and libvlccore
The apps purpose (which works) is to read a spreadsheet .csv file which holds
filenames and runtimes in seconds.
When the Runtime expires, the video/Picture/Music is stopped and the next File is played.
If a push button is pressed then it will use a different group of files.
Once all files are played it restarts from the beginning.
The 'Pseudo' code
vlc is fully installed and if this code is run from a CLI once X was started then Alt F4 will exit the video.
Attempting to use Alt F4 or 'q' without starting X is ignored.
Once installed on site, I will need to exit and Starx to make any changes.
Hoping someone can shed some light on this.
Regards
Originally posted here:[url][https://forum.videolan.org/viewtopic.ph ... 165660/url]
But after graduating to using the library, thought this the better place.
Using a Rpi Zero W 2 booting directly to cli as a headless system.
In other words X is not loaded.
Then in /etc/rc.local I start my app.
This app is developed in FreeBasic and uses libvlc and libvlccore
The apps purpose (which works) is to read a spreadsheet .csv file which holds
filenames and runtimes in seconds.
When the Runtime expires, the video/Picture/Music is stopped and the next File is played.
If a push button is pressed then it will use a different group of files.
Once all files are played it restarts from the beginning.
The 'Pseudo' code
Code: Select all
Dim as string qStr = "--global-key-quit " & Chr(34) & "q" '' An attempt to get q to work ??
Dim As Any Ptr vlc_args(0 To ...) = { @"--no-xlib",@"--quiet",@qStr} '' does not produce a vlc error.
instance = libvlc_new (UBound(vlc_args) + 1, @vlc_args(0)) ''libvlc_new (0, NULL) 'Load the VLC engine
media = libvlc_media_new_path(instance, .Next2Play) ''Load media file
mediaPlayer = libvlc_media_player_new_from_media(media) ''Create a media player playing environement
libvlc_media_release(media) ''No need to keep the media now
libvlc_media_player_play(mediaPlayer) ''Play the media
Do
TimeGet
#if defined(Rpi)
If Times.mSec - Times.GetIO > 750 Then ''only look for PB every Sec
Get_Inputs
Times.GetIO = Times.mSec
EndIf
#endif
If Next_Group > 0 Then Exit Do ''or a Button was pressed, goto List1 or 2
If Val(Entry.RunTime(Xq)) > 0 Then ''using Libvlc to detect that Video is finished
If Times.Secs - Times.StartTime > Val(Entry.RunTime(Xq)) Then Exit do''Is just to time consuming and not suitable
EndIf ''for showing jpeg's, so set time for each one.
Sleep 1,1
Loop
libvlc_media_player_stop(mediaPlayer) ''Stop playing
libvlc_media_player_release(mediaPlayer) ''Free the media_player
If Next_Group > 0 Then Exit For
Attempting to use Alt F4 or 'q' without starting X is ignored.
Once installed on site, I will need to exit and Starx to make any changes.
Hoping someone can shed some light on this.
Regards