【发布时间】:2018-04-29 14:48:36
【问题描述】:
这是使用“Alt+P”按键暂停和播放的音频播放器脚本。
https://github.com/jonmbake/jquery-html5-audioplayer
我想添加一个文本框,在我输入时我希望音频自动暂停,当我停止输入时我希望音频开始播放。
【问题讨论】:
-
请添加您遇到问题的代码。
标签: javascript jquery audio audio-player
这是使用“Alt+P”按键暂停和播放的音频播放器脚本。
https://github.com/jonmbake/jquery-html5-audioplayer
我想添加一个文本框,在我输入时我希望音频自动暂停,当我停止输入时我希望音频开始播放。
【问题讨论】:
标签: javascript jquery audio audio-player
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Audio Player Demo</title>
<meta name="description" content="Demo of the Audio Player jQuery plugin.">
<meta name="author" content="Jon Bake">
<link rel="stylesheet" href="src/jquery.audio-player.css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="audio-player"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="src/jquery.audio-player.js"></script>
<script>
$('#audio-player').audioPlayer();
//togglePlay
</script>
<script>
$(document).ready(function(){
$("input").keypress(function(){
// I want to call the function in the src/jquery.audio-player.js
// when the play and pause button is executed with below
// this.$playPause.on("click", this.togglePlay.bind(this));
// How to enable togglePlay() when we keep typing and stoping the typing
});
});
</script>
<input id="target" type="text" value="">
</body>
</html>
【讨论】: