PDA

View Full Version : Prevent page reload / HTML5 Audio Capture



tgiasuunyday
17 Jul 2014, 10:22 AM
Hello,

I have my Exts application in an html page. The viewport of my application has 4 regions (North, West, Center and South) (cf. picture viewport.jpg (https://www.dropbox.com/s/oiwyf4lni7nqo9o/viewport.jpg)).

In the center, I have a grid.

1. When the page is loaded, I am asking an html5 audio capture (microphone) (with navigator.getUserMedia).
2. Then there's this prompt by the navigator asking the user to authorize the access of the micrphone.

The problem is when the browser is asking the authorization, when this prompt shows it reloads the page. This creates a loop because then the page is asking again the micrpohone access again.


Do you know how can I prevent this page reload again and again?

Thank you.

israelroldan
24 Jul 2014, 3:44 AM
Which browser are you using to test this? I have just tested a vanilla-js implementation of this (based on http://www.scottpreston.com/articles/1442.php) and it doesn't reload the DOM upon permissions request: https://fiddle.sencha.com/fiddle/817/preview

tgiasuunyday
24 Jul 2014, 5:51 AM
Hello israelroldan,

Thank you for you help. It works with you example, yes. But the problem is that in my case, my panel is set to 'fit' layout. Meaning that if my panel/browser window gets resized, the panel will be reloaded to fit the new size/content.

When the browser (Chrome) asks for an autorization (html5 micropohne or video, etc), it displays a little horizontal bar on the top that changes the panel/content size. This forces ExtjsJS to reload my panel to fit the new content.

Then it's a loop..

I hope I am clear enough so you see my point


--
Thank you.

israelroldan
24 Jul 2014, 6:30 AM
Neither the page nor the panel should get reloaded when that prompt appears. They should get resized. Do you have any listeners that explicitly reload them? Could you perhaps put together a sample in Sencha Fiddle so I and other members of the community can see what we're talking about?

tgiasuunyday
24 Jul 2014, 7:47 AM
Yes, it's a good idea. I will try to reproduce with a fiddle example and put it here as soon as it is finished

Thank you!

tgiasuunyday
18 Aug 2014, 11:32 AM
The problem was my sound card not properly detected by the browser causing the constant prompt.

israelroldan
18 Aug 2014, 11:34 AM
Wow! That's definitely one for the record, I have never had that issue. Thanks for sharing!