Created
October 28, 2013 23:13
-
-
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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