Coder Social home page Coder Social logo

Comments (7)

soyjavi avatar soyjavi commented on July 30, 2024

Play doesn't exists in QuoJS ;)

Enviado desde mi iPad

El 16/01/2012, a las 19:47, "César"
[email protected]
escribió:

Hi,

When I try to play an 'audio' element with QuoJS, nothing happens.

Here is the code I'm using: https://gist.github.com/1621963

If I click the 'play' link at chrome/safari it works fine. The audio plays and the duration is logged to the console.
If I try it in safari mobile, both iPhone Simulator or real iPad, the audio doesn't play and the console.log() writes 'NaN'

I've the same issue with Lungo 1.0.4 but it works fine using zepto.js and without any library.

Best,
César.


Reply to this email directly or view it on GitHub:
#6

from quojs.

temperatio avatar temperatio commented on July 30, 2024

But .play() is a valid method of the audio element. I only use QuoJS to get the element.

I think is a QuoJS issue because it works fine with zepto, jquery, etc.

from quojs.

temperatio avatar temperatio commented on July 30, 2024

I don't know if helps, but if I use

$$(document).ready(function() {
  btn = document.getElementById('pbutton');
  btn.addEventListener('click', function(){
    var s = $$('#snd').get(0);
    console.log("Duration: " + s.duration);
    s.play();
  }, false);
});

instead of

$$(document).ready(function() {
  $$('#pbutton').tap(function(){
    var s = $$('#snd').get(0);
    console.log("Duration: " + s.duration);
    s.play();
  });
});

it works fine! :)

from quojs.

soyjavi avatar soyjavi commented on July 30, 2024

I think the problem it's the delegate events, try this:

$$(document).ready(function() {
 $$('#pbutton').bind('tap', function(){
   var s = $$('#snd').get(0);
   console.log("Duration: " + s.duration);
   s.play();
 });
});

from quojs.

temperatio avatar temperatio commented on July 30, 2024

I've tested it and, I don't know if it make sense to you, but with 'tap' doesn't work but changing it to 'click' works!

e.g:

$$(document).ready(function() {
 $$('#pbutton').bind('click', function(){
   var s = $$('#snd').get(0);
   console.log("Duration: " + s.duration);
   s.play();
 });
});

I've also tested with 'swipe' event and fails. Could be a problem with 'touch' events?

The events are catched, but the audio element doesn't works as expected.

from quojs.

soyjavi avatar soyjavi commented on July 30, 2024

Tap, DoubleTap, LongTap and Swipe are a mobile environment events :)

from quojs.

temperatio avatar temperatio commented on July 30, 2024

Whatever :P

from quojs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.