-
-
01 Sep 2009 12:28:10 UTC
- Distribution: Win32-MediaPlayer
- Module version: 0.3
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (4)
- Testers (3 / 0 / 0)
- Kwalitee
Bus factor: 0- % Coverage
- License: unknown
- Activity
24 month- Tools
- Download (11.05KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Win32::API
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Win32::MediaPlayer - Module for playing sound MP3 / WMA / WAV / MIDI file on Win32 platforms
SYNOPSIS
use Win32::MediaPlayer; $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. };
DESCRIPTION
This module allows playing of sound format like MP3 / WMA / WAV / MIDI on Win32 platforms using the MCI interface (which depends on winmm.dll).
REQUIREMENTS
Only working on Win32, and you should installed the Win32::API
if not you can install by ppm, in the console mode
type command:
ppm install http://www.bribes.org/perl/ppm/Win32-API.ppd
USAGE
new
The new method is the constructor. It will build a connection to the mci interface.
$winmm = new Win32::MediaPlayer; # new an object
load()
$winmm->load('d:/10.mp3'); # Load music from the disk, or Internet URL.
play
$winmm->play; # Play the music file.
seek()
The value should be a format like XX:XX, or you can fill the micro second integer of the music.
$winmm->seek(100000); # Seek the music file, at the 100 sec pos.
$winmm->seek('01:40'); # Seek the music file, at the 01 min 40 sec pos.
close
$winmm->close; # Close the music file.
volume()
The value is from 0 to 100
$winmm->volume(100); # Set volume to 100 after playing
length()
Return the music total length
$length = $winmm->length(1); # Return the length in XX:XX format.
$length = $winmm->length; # Return the length in micro second integer.
pos()
Return the music now position
$length = $winmm->pos(1); # Return the Position in XX:XX format.
$length = $winmm->pos; # Return the Position in micro second integer.
pause
Pause the music play
$length = $winmm->pause; # Pause the music play.
resume
Resume the music play
$length = $winmm->resume; # Resume the music play.
AUTHOR
Lilo Huang
COPYRIGHT
Copyright 2006 by Lilo Huang All Rights Reserved.
You can use this module under the same terms as Perl itself.
Module Install Instructions
To install Win32::MediaPlayer, copy and paste the appropriate command in to your terminal.
cpanm Win32::MediaPlayer
perl -MCPAN -e shell install Win32::MediaPlayer
For more information on module installation, please visit the detailed CPAN module installation guide.