Skip to content

Instantly share code, notes, and snippets.

@alicraigmile
Created October 28, 2013 23:13
Show Gist options
  • Save alicraigmile/7206488 to your computer and use it in GitHub Desktop.
Save alicraigmile/7206488 to your computer and use it in GitHub Desktop.
An old sample of code showing how to play MP3s on a windows machine in perl (god only knows why I wanted to).
use Win32::MediaPlayer;
my $winmm = new Win32::MediaPlayer; # new an object
$winmm->load('d:/10.mp3'); # Load music file disk, or an URL
$winmm->play; # Play the music
$winmm->volume(100); # Set volume after playing
$winmm->seek('00:32'); # seek to
#$winmm->pause; # Pause music playing
#$winmm->resume; # Resume music playing
print 'Total Length : '.$winmm->length(1),$/; # Show total time.
while(1) {
sleep 1;
print 'Now Position: '.$winmm->pos(1)."\r"; # Show now time.
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment