Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    822
    Thanks
    93
    Thanked 18 Times in 18 Posts

    Is this possible with PHP? List .avi files and open them in WMP

    Is that possible to do with PHP? Id like to create a list of files (90% avi video files) on a certain folder (which is on an external hard drive) and when i click on them id like them to open up and play using Windows Media Player.

    I've never tried doing anything like that before so i thought it would be a good idea to find out if this is even possible before attempting any thing

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Sure, only locally of course. Use an exec or similar system call and launch the wmplayer:
    Code:
    "%ProgramFiles%\Windows Media Player\wmplayer.exe" /play "/path/to/file"

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Sure, only locally of course. Use an exec or similar system call and launch the wmplayer:
    Code:
    "%ProgramFiles%\Windows Media Player\wmplayer.exe" /play "/path/to/file"

  • Users who have thanked Fou-Lu for this post:

    tomharto (02-01-2012)

  • #4
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    822
    Thanks
    93
    Thanked 18 Times in 18 Posts
    Ahh great , time to get coding , thanks for your help

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    You bet.
    This will work with start as well. Gave me some trouble then realized it couldn't tell the difference between a title and a path :/
    Code:
    start "" "/path/to/file.mp3"
    Start should associate the mp3 with the registered default player (wmp).

  • #6
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    822
    Thanks
    93
    Thanked 18 Times in 18 Posts
    Thanks for the tip . just curious, in the first snippet you posted, what do the '%' around Program Files do?

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Environment variable, PROGRAMFILES refers to the path for your programs.
    I can only test this on a x86 machine at work here, but given another registered environment in windows7 is PROGRAMFILES(x86) I'd suspect that program files environment is always the primary architecture. % is simply used in CLI to expand the variable to its value.

  • #8
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    822
    Thanks
    93
    Thanked 18 Times in 18 Posts
    Oh, okay. Thanks

  • #9
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,090
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Only thing I'm seeing here is that it won't put the files into the playlist. You'd need the exact length of each file, sleep the script for that duration and then execute the next file.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #10
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    822
    Thanks
    93
    Thanked 18 Times in 18 Posts
    Atm a playlist isnt a problem, ill only be watching one or two each time at most, however if i ever need to create a playlist i think ill have a fair bit of googling to do .


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •