mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-07 23:03:11 +08:00
112 lines
2.1 KiB
HTML
Executable File
112 lines
2.1 KiB
HTML
Executable File
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
"http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=320; user-scalable=no" />
|
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
|
<title>PhoneGap</title>
|
|
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
|
|
|
<style>
|
|
|
|
.mediaBtn
|
|
{
|
|
clear:none;
|
|
float:left;
|
|
background:rgba(64,64,64,0.5);
|
|
border: 1px solid rgba(128,128,128,0.5);
|
|
-webkit-border-radius: 5px;
|
|
border-radius: 5px;
|
|
margin:20px;
|
|
width:64px;
|
|
padding:4px;
|
|
|
|
}
|
|
|
|
</style>
|
|
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
|
|
<script type="text/javascript" charset="utf-8">
|
|
|
|
var PS_STOPPED = 0;
|
|
var PS_PLAYING = 1;
|
|
var PS_PAUSED = 2;
|
|
var PS_RECORDING = 3;
|
|
|
|
var currentState;
|
|
|
|
var mediaFile = null;
|
|
|
|
function onPlayStopBtn()
|
|
{
|
|
if(currentState != PS_PLAYING)
|
|
{
|
|
mediaFile.play({numberOfLoops:0});
|
|
currentState = PS_PLAYING;
|
|
document.getElementById("playText").innerHTML = "Stop";
|
|
}
|
|
else
|
|
{
|
|
mediaFile.stop();
|
|
currentState = PS_STOPPED;
|
|
document.getElementById("playText").innerHTML = "Play";
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
function onMediaCreatedSuccess(obj)
|
|
{
|
|
alert("successfully created media");
|
|
}
|
|
|
|
function onMediaCreatedError(err)
|
|
{
|
|
alert("error creating media");
|
|
}
|
|
|
|
|
|
|
|
|
|
function onWinLoad()
|
|
{
|
|
document.addEventListener("deviceready",onDeviceReady,false);
|
|
}
|
|
|
|
function onDeviceReady()
|
|
{
|
|
mediaFile = new Media('percBass.wav',onMediaCreatedSuccess,onMediaCreatedError);
|
|
updateButtonStates();
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body id="stage" class="theme" onload="onWinLoad()">
|
|
<div class="topBar">
|
|
<a href="index.html">
|
|
<span class="back_button">Back</span>
|
|
</a>
|
|
<span class="pageTitle">Media</span>
|
|
</div>
|
|
|
|
<h2>percBass.wav</h2>
|
|
<a href="#" onclick="onPlayStopBtn();">
|
|
<div class="mediaBtn">
|
|
<h2 id="playText">Play</h2>
|
|
</div>
|
|
</a>
|
|
|
|
|
|
|
|
<!--
|
|
<a href="#" onclick="onRecordBtn();">
|
|
<div class="mediaBtn">
|
|
<h2>Record</h2>
|
|
</div>
|
|
|
|
</a>
|
|
-->
|
|
</body>
|
|
</html>
|