I made a php script that contains .m3u8 url's what i got from:
https://github.com/iptv-org/iptv
(These are publicly free and open channels to watch TV stations from all over the world)
For that i used Laravel+NativePHP
NativePHP allows you to build desktop apps for Windows,Linux an Mac os. (pretty cool!)
So far the introduction.
What am i try to achieve and what i already have working ?
Based from the .m3u8 url list i am able to click on an item so that vlc opens with the selected url.
This works perfectly out-of-the-box with the code below:
My Controller.php
Code: Select all
public function videoPlayer($video_id){
//get the url $video->url
$video = DB::table('channels')->where('id', $video_id)->first();
//open command.php to exec() vlc.exe with url
//use popen/pclose so exec() does not wait on close vlc
$fileName = storage_path() . '/app/command.php';
pclose( popen("start /b php $fileName $video->url", 'rb' ) );
//after click an item proceed with the rest of the php function
return view('welcome');
}
Code: Select all
define('VLC', '"C:\Program Files\VideoLAN\VLC\vlc.exe"');//path to VLC
exec(VLC.' '.$argv[1]); //$argv[1] contains $video->url
Like i said the code above works without any issues, vlc.exe is started and plays the selected item out of the list!
But something happens what i not like in this situation, namely, each time i click on another item out of my url list ....
The above code is executed , but it opens a new instance of vlc.exe with the selected video playing.
Is there a way to inject VLC with only the new selected $video->url. to the "already running vlc.exe"?
If i have to change to a different approach i am more then willing to do that.