terremoth/php-win32-playwav
最新稳定版本:v1.0.0
Composer 安装命令:
composer require terremoth/php-win32-playwav
包简介
Play wav (wave) files natively with PHP on Windows
README 文档
README
Play wav (wave) files natively with PHP on Windows. Zero extensions or dependencies needed!
It uses PlaySound from winmm.dll, unlocked by the power of PHP FFI
Not because we must do it, but because we can!
Made by Terremoth with ⚡ & ❤
See demos/demo.php for examples.
Installation
composer require terremoth/php-win32-playwav
Documentation
Play Sync
<?php require 'vendor/autoload.php'; use Win32Sound\PlayWav; $sound = new PlayWav('test.wav'); $sound->play();
Play Async
<?php require 'vendor/autoload.php'; use Win32Sound\PlayWav; $sound = new PlayWav('test.wav'); $sound->async()->play();
Loop the audio
Also, you can "loop" and then, stop if you want.
IMPORTANT: loop() requires ->async() at some point, in order to work due to Windows API:
<?php require 'vendor/autoload.php'; use Win32Sound\PlayWav; $sound = new PlayWav('test.wav'); $sound->async()->loop()->play(); // if the scripts ends it will "kill" the audio process, // so, to listen just put a sleep in order to test sleep(5); // if you want to stop the looping audio, just: $sound->stop();
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2024-11-20