I'm handling the touchstart and touchend events to determine when an element is clicked. It works very well and is responsive, but I'm missing the default click sound that happens in native apps when you press a button.
Is there a way to trigger this sound with PhoneGap rather then using html5 audio?
Well, I have developed new Cordova plugin a few days ago which provide that you need.
Take look at https://github.com/VVelda/device-feedback
You can then call native sound response on button click. No any audio media, or any other workaround. I hope it will help you, altough you already set the answer that help you. :-)
Take a look at the Media class.
http://docs.phonegap.com/en/2.9.0/cordova_media_media.md.html#Media
Have a look at this blog post:
http://pieterderycke.wordpress.com/2014/01/20/native-tick-sound-on-button-click-with-phonegap/
It explains how to develop a PhoneGap plugin that plays the native click sound when pressing a button in HTML5.
Related
Go to an url such as:
https://www.youtube.com/embed/zvCBSSwgtg4
and open the chrome console. I want to know what javascript command will play the youtube video and what javascript command will pause the youtube video.
I've tried using the profiler and inspector to find these commands but they are too well hidden. If someone is really good at javascript debugging, this would be a big help. Thanks!
Yes, I know youtube has API for iframes, but my use case is different.
For HTML5 youtube player simply doing:
document.getElementsByTagName('video')[0].play()
document.getElementsByTagName('video')[0].pause()
I recently created a chrome extension for same: https://chrome.google.com/webstore/detail/youtube-playback-control/okbcoijdeebocmahlanbfemnckjonfnh
Hope it helps.
Have you tried triggering a click on the actual play/pause button?
document.getElementsByClassName('ytp-play-button')[0].click();
This should be easy to do, just check for event attached to the button that you pushed and then trigger them manually using.
For example if the button has a jQuery event handler use:
http://api.jquery.com/trigger/
Or if it is a native JavaScript event you can use:
How to trigger event in JavaScript?
I have been working on making a wonderful site to play the GoT shame sound when a shame event is published in particle's SSE queue. Currently I have this working great on every device (iPad/Android/Desktop/etc) except for the iPhone.
For mobile devices I am using the ontouchstart event to play/pause the audio file so that I can later initiate the JS play method when the shame SSE is seen. When I add in the controls option the sound can be played by pressing play on the phone. Even after that it is unable to be triggered via JS. Any help would be appreciated. See code below
Code: https://gist.github.com/nctiggy/17e87e68dedf8c4c4530
Deployed to site: http://cersei.cfapps.io
Answered my own problem:
Needed to run the load() method before the initial play/pause at the ontouchstart event.
Here is the working code: https://gist.github.com/nctiggy/67edb2df65b10ea28a58
I'm trying to make jwplayer show the native iPhone play button (see below) on iPhone, and a custom skin elsewhere. I've tried to use chromeless: true, but it didn't help (I still get the skinned play button). Now I'm stuck in jwplayer code and can't find my way through. Can you help me out?
I'm afraid we fail back to the default iOS tag so it is not possible to show our native play icon. However, in a future release we plan on adding out own mobile UX/UI, so this will be possible then!
I'm currently creating an iPhone web application for piano chords, and I wanted to add an option that would let the user press a Play button and play the selected chord. However, I'm not sure how to do this, or if it's even possible.
Basically, is there any way to programmatically (through Javascript) play a sound file (wav, mp3,...) in the background? (i.e. not leaving the page)
Thanks for any help!
(Keep in mind that I'm developing a web app, so I'm using HTML, CSS & JS, not the native SDK)
short answer: no
from the docs:
Safari on iPhone plays audio and video
in webpages in fullscreen playback
mode only.
yes you can.
http://www.schillmania.com/projects/soundmanager2/
see it in action at soundcloud.com
With HTML5 audio, iPhone can play without fullscreen.
IOS requires sound be played with the press of a control button. If you are looking to autoplay a sound at some event on an HTML page, forget it.
Using jQuery, is there a way to disable the click sound in IE that happens when you post?
The IE click sound is a feature of the browser that you can't control from JavaScript. The only way to disable it is in System Sounds in the Control Panel.
It may very well be possible using this solution: http://www.julienlecomte.net/blog/2007/11/30/
But in short, John is right about it being a browser sound not controlled by javascrÃpt or anyting else than a registry change, wich a website will not manage to do.
I know the above "trick" has worked before, so if nothing has changed it will still work.