so the context:
I want to make a bash terminal command that will launch VLC to stream a video, and then when VLC is no longer in the foreground (VLC automatically goes to the background when the stream is interrupted too long), it will repeat the command to launch VLC to stream again.
I got the working separate command codes, but I don't have any idea how to make these work into one command that keeps repeating.
This will launch/bring to the foreground the default app for RTSP (in this case, VLC) and starts streaming.
2. To check whether VLC is still in the foreground or not
This will return something like this when VLC is in the foreground.
and will return nothing in the terminal if VLC is not in the foreground.
so maybe the code will be doing something like this?
every 1 second, check for VLC is in the foreground or not (using code number 2). If VLC is not in the foreground, launch vlc with the streaming URL (using code number 1).
i posted this question here too https://superuser.com/questions/168...peated-after-an-activity-no-longer-foreground
I want to make a bash terminal command that will launch VLC to stream a video, and then when VLC is no longer in the foreground (VLC automatically goes to the background when the stream is interrupted too long), it will repeat the command to launch VLC to stream again.
I got the working separate command codes, but I don't have any idea how to make these work into one command that keeps repeating.
- To launch VLC and starts streaming:
Code:
am start -a android.intent.action.VIEW -d rtsp://theurl
This will launch/bring to the foreground the default app for RTSP (in this case, VLC) and starts streaming.
2. To check whether VLC is still in the foreground or not
Code:
dumpsys activity activities | sed -e '/mResumedActivity/!d' -e '/vlc/!d'
This will return something like this when VLC is in the foreground.
Code:
mResumedActivity: ActivityRecord{b43545d u0 org.videolan.vlc/.gui.video.VideoPlayerActivity t11827}
and will return nothing in the terminal if VLC is not in the foreground.
so maybe the code will be doing something like this?
every 1 second, check for VLC is in the foreground or not (using code number 2). If VLC is not in the foreground, launch vlc with the streaming URL (using code number 1).
i posted this question here too https://superuser.com/questions/168...peated-after-an-activity-no-longer-foreground