Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

asfaria

Codigo JS não acessa o player para controle.

Recommended Posts

Alguem poderia me ajudar a ver o erro do codigo, meu js nâo aponta para meu player d audio.

Obrigado!

<!DOCTYPE html>
<html lang="pt-br">
 
<head>
     <meta charset="utf-8">
<title>Cantora Gospel</title>
<meta name="">
<meta name="decription" content="">
<link rel="stylesheet" href="css/estilo.css">
<script src="javascript.js"></script>
<script type="text/javascript" src="js/controls.js"></script> 
 
</head>
 
<body id="home">
   
 
<header>
<div id="wrapper">
<audio id="mytrack" controls>
        <source src="audio/som.mp3" type="audio/mp3"/>
 
</audio>
<nav>
    <div id="defaultBar">
   <div id="progressBar"></div>
</div>
<div id="buttons">
     <button type="button" id="playButton" onclick="playOrPause()"></button>
     <button type="button" id="muteButton"></button>
 <span id="currentTime">0:00</span> 
/ <span id="fullDuration">0:00</span>
     
</div>
</nav>
</div>
 
</header>
 
 
<div class="container">
 
        <nav id="menu">
    <ul id="nav">
   <li><a href="index.html" id="ho">Home</a></li>
<li><a href="news.html">News</a></li>
<li><a href="perfil.html">Perfil</a></li>
<li><a href="fotos.html"class="active">Fotos</a></li>
<li><a href="videos.html">Videos</a></li>
<li><a href="discografia.html">Discografia</a></li>
</ul>
</nav>
 
 
 
 <section>Conteudo</section>
 <aside>Relacionado</aside>
 <footer>Roda Pé</footer>
</div>
 
 
</body>
</html>
 
 
 
 
 
Javascript.
 

var mytrack = document.getElementById('mytrack');
var playButton = document.getElementById('playButton');
 
function playOrPause(){
if(!mytrack.paused && !mytrack.ended){
mytrack.pause();
playButton.style.backgroundImage = 'url(../imagens/play.png)';
}
else{
mytrack.play();
playButton.style.backgroundImage = 'url(../imagens/pause.png)';
}
}
 

Compartilhar este post


Link para o post
Compartilhar em outros sites
scriptaculous.js?load=effects,dragdrop,builder:31 A Parser-blocking, cross-origin script, http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8/effects.js, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity. See https://www.chromestatus.com/feature/5718547946799104 for more details.

require @ scriptaculous.js?load=effects,dragdrop,builder:31

scriptaculous.js?load=effects,dragdrop,builder:31 A Parser-blocking, cross-origin script, http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8/dragdrop.js, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity. See https://www.chromestatus.com/feature/5718547946799104 for more details.

require @ scriptaculous.js?load=effects,dragdrop,builder:31

scriptaculous.js?load=effects,dragdrop,builder:31 A Parser-blocking, cross-origin script, http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8/builder.js, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity. See https://www.chromestatus.com/feature/5718547946799104 for more details.

require @ scriptaculous.js?load=effects,dragdrop,builder:31

VM2971:1 'webkitOfflineAudioContext' is deprecated. Please use 'OfflineAudioContext' instead.

(anonymous) @ VM2971:1


da uma olhada para mim

Compartilhar este post


Link para o post
Compartilhar em outros sites

Foi mal é este

file:///C:/Users/Alexandre-Pc/Desktop/Curso_html/javascript.js Failed to load resource: net::ERR_FILE_NOT_FOUND
controls.js:5 Uncaught TypeError: Cannot read property 'paused' of null
at playOrPause (controls.js:5)
at HTMLButtonElement.onclick (VM32 fotos.html:29)
controls.js:5 Uncaught TypeError: Cannot read property 'paused' of null
at playOrPause (controls.js:5)
at HTMLButtonElement.onclick (VM32 fotos.html:29)
controls.js:5 Uncaught TypeError: Cannot read property 'paused' of null
at playOrPause (controls.js:5)
at HTMLButtonElement.onclick (VM32 fotos.html:29)
controls.js:5 Uncaught TypeError: Cannot read property 'paused' of null
at playOrPause (controls.js:5)
at HTMLButtonElement.onclick (VM32 fotos.html:29)
controls.js:5 Uncaught TypeError: Cannot read property 'paused' of null
at playOrPause (controls.js:5)
at HTMLButtonElement.onclick (VM32 fotos.html:29)
controls.js:5 Uncaught TypeError: Cannot read property 'paused' of null
at playOrPause (controls.js:5)
at HTMLButtonElement.onclick (VM32 fotos.html:29)
controls.js:5 Uncaught TypeError: Cannot read property 'paused' of null
at playOrPause (controls.js:5)
at HTMLButtonElement.onclick (VM32 fotos.html:29)
controls.js:5 Uncaught TypeError: Cannot read property 'paused' of null
at playOrPause (controls.js:5)
at HTMLButtonElement.onclick (VM32 fotos.html:29)
controls.js:5 Uncaught TypeError: Cannot read property 'paused' of null
at playOrPause (controls.js:5)
at HTMLButtonElement.onclick (VM32 fotos.html:29)
controls.js:5 Uncaught TypeError: Cannot read property 'paused' of null
at playOrPause (controls.js:5)
at HTMLButtonElement.onclick (VM32 fotos.html:29)

Compartilhar este post


Link para o post
Compartilhar em outros sites

troca a tua tag script de lugar. coloca antes de fechar o </body>

<!DOCTYPE html>
<html lang="pt-br">
 
<head>
     <meta charset="utf-8">
<title>Cantora Gospel</title>
<meta name="">
<meta name="decription" content="">
<link rel="stylesheet" href="css/estilo.css">
 
</head>
 
<body id="home">
   
 
<header>
<div id="wrapper">
<audio id="mytrack" controls>
        <source src="audio/som.mp3" type="audio/mp3"/>
 
</audio>
<nav>
    <div id="defaultBar">
   <div id="progressBar"></div>
</div>
<div id="buttons">
     <button type="button" id="playButton" onclick="playOrPause()"></button>
     <button type="button" id="muteButton"></button>
 <span id="currentTime">0:00</span> 
/ <span id="fullDuration">0:00</span>
     
</div>
</nav>
</div>
 
</header>
 
 
<div class="container">
 
        <nav id="menu">
    <ul id="nav">
   <li><a href="index.html" id="ho">Home</a></li>
<li><a href="news.html">News</a></li>
<li><a href="perfil.html">Perfil</a></li>
<li><a href="fotos.html"class="active">Fotos</a></li>
<li><a href="videos.html">Videos</a></li>
<li><a href="discografia.html">Discografia</a></li>
</ul>
</nav>
 
 
 
 <section>Conteudo</section>
 <aside>Relacionado</aside>
 <footer>Roda Pé</footer>
</div>
 
 

<script src="javascript.js"></script>
<script type="text/javascript" src="js/controls.js"></script> 
</body>
</html>
 

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.