added audioplayer contrib module

This commit is contained in:
Bachir Soussi Chiadmi
2017-11-25 16:05:32 +01:00
parent ff23c45e43
commit 0942e9a212
174 changed files with 21682 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
var app = angular.module('ngWavesurfer', []);
app.directive('ngWavesurfer', function () {
return {
restrict: 'E',
link: function ($scope, $element, $attrs) {
$element.css('display', 'block');
var options = angular.extend({ container: $element[0] }, $attrs);
var wavesurfer = WaveSurfer.create(options);
if ($attrs.url) {
wavesurfer.load($attrs.url, $attrs.data || null);
}
$scope.$emit('wavesurferInit', wavesurfer);
}
};
});
app.controller('PlaylistController', function ($scope) {
var activeUrl = null;
$scope.paused = true;
$scope.$on('wavesurferInit', function (e, wavesurfer) {
$scope.wavesurfer = wavesurfer;
$scope.wavesurfer.on('play', function () {
$scope.paused = false;
});
$scope.wavesurfer.on('pause', function () {
$scope.paused = true;
});
$scope.wavesurfer.on('finish', function () {
$scope.paused = true;
$scope.wavesurfer.seekTo(0);
$scope.$apply();
});
});
$scope.play = function (url) {
if (!$scope.wavesurfer) {
return;
}
activeUrl = url;
$scope.wavesurfer.once('ready', function () {
$scope.wavesurfer.play();
$scope.$apply();
});
$scope.wavesurfer.load(activeUrl);
};
$scope.isPlaying = function (url) {
return url == activeUrl;
};
});
@@ -0,0 +1,120 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>wavesurfer.js | Angular</title>
<link href="data:image/gif;" rel="icon" type="image/x-icon" />
<!-- Bootstrap -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
<link rel="screenshot" itemprop="screenshot" href="https://katspaugh.github.io/wavesurfer.js/example/screenshot.png" />
<!-- AngularJS -->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<!-- wavesurfer.js -->
<script src="../../dist/wavesurfer.js"></script>
<!-- App -->
<script src="app.js"></script>
</head>
<body ng-app="ngWavesurfer" ng-controller="PlaylistController">
<div class="container">
<div class="header">
<ul class="nav nav-pills pull-right">
<li><a href="/"><i class="glyphicon glyphicon-home"></i></a></li>
</ul>
<h1 itemprop="name">wavesurfer.js Angular Demo</h1>
</div>
<div id="demo">
<div class="row" style="margin: 30px 0">
<div class="col-sm-10">
<ng-wavesurfer url="../media/demo.wav" wave-color="#337ab7" progress-color="#23527c" height="64">
</ng-wavesurfer>
</div>
<div class="col-sm-2">
<button class="btn btn-success btn-block" ng-click="wavesurfer.playPause()">
<span id="play" ng-show="paused">
<i class="glyphicon glyphicon-play"></i>
Play
</span>
<span id="pause" ng-show="!paused">
<i class="glyphicon glyphicon-pause"></i>
Pause
</span>
</button>
</div>
</div>
<div class="list-group" id="playlist">
<a href=""
ng-class="{ 'list-group-item': true, active: isPlaying('../media/demo.wav') }"
ng-click="play('../media/demo.wav')">
<i class="glyphicon glyphicon-play"></i>
czskamaarù Trou
<span class="badge">0:21</span>
</a>
<a href=""
ng-class="{ 'list-group-item': true, active: isPlaying('../panner/media.wav') }"
ng-click="play('../panner/media.wav')">
<i class="glyphicon glyphicon-play"></i>
日本人の話し
<span class="badge">1:04</span>
</a>
<a href=""
ng-class="{ 'list-group-item': true, active: isPlaying('../elan/transcripts/001z.mp3') }"
ng-click="play('../elan/transcripts/001z.mp3')">
<i class="glyphicon glyphicon-play"></i>
Рассказы о сновидениях
<span class="badge badge-info">1:26</span>
</a>
</div>
</div>
<div class="footer row">
<div class="col-sm-12">
</div>
<div class="col-sm-7">
<span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" property="dct:title" rel="dct:type">wavesurfer.js</span> by <a href="https://github.com/katspaugh/wavesurfer.js">katspaugh</a> is licensed under a <a rel="license" href="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause License</a>.
</div>
<div class="col-sm-5">
<p>
Audio sources:<br />
<a rel="nofollow" href="http://www.jamendo.com/en/track/661578/trou"><b>Trou</b> <span class="muted">by</span>&nbsp;<b>czskamaarù</b></a>,
<a rel="nofollow" href="http://spokencorpora.ru/">spokencorpora.ru</a>
</p>
</div>
</div>
</div>
<div class="github-fork-ribbon-wrapper right">
<div class="github-fork-ribbon">
<a itemprop="isBasedOnUrl" href="https://github.com/katspaugh/wavesurfer.js">Fork me on GitHub</a>
</div>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50026819-1', 'wavesurfer.fm');
ga('send', 'pageview');
</script>
</body>
</html>