PHP code example of denar90 / yii2-wavesurfer-audio-widget

1. Go to this page and download the library: Download denar90/yii2-wavesurfer-audio-widget library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

denar90 / yii2-wavesurfer-audio-widget example snippets


use denar90\waveSurferAudio\WaveSurferAudioWidget;

echo WaveSurferAudioWidget::widget([
	'settings' => [
		'fileUrl' => url_to_your_mp3_file,
		'init' => [
			'container' => 'selector_name' //it has to be id not class
		],
		'callbacks' => [
			'ready' => new \yii\web\JsExpression("function(event) {
				this.play();
			}")
		],
		'controls' => [
			'play' => true,
			'pause' => true
		]
	]
]);