Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Zukka
Posts: 201
Registered: ‎05-08-2012
My Device: PlayBook 64 Gb and Z10 LE

Hide http windows

hello experts. I'm developing an app and I want to play in the background audio from a Web radio without displaying the dialog. I decided to open the link, and hide the page .. is right or wrong? if it is correct please tell me how to hide the page? if it is wrong you give me a hint on how to do? thanks in advance. Check in from other platforms, and I never developed in html. :smileyhappy:
_______________________________________________

If U like my post click on LIKE :smileywink:
Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha

Re: Hide http windows

Hi!

check the API for HTML5 Audio element, you can use it to play streaming audio :smileyhappy:

cheers

Nuno
theBBthing.wordpress.com - my BlackBerry development blog: news, tips and tutorials
bitoutsidethebox.com - re-imagining digital solutions


Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Hide http windows

The best way, like Nuno said, is using HTML5 audio. An example looks like this:

 

var audio = document.createElement('audio');
audio.src="URL2YourAudioStream";
audio.play();

"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Developer
Zukka
Posts: 201
Registered: ‎05-08-2012
My Device: PlayBook 64 Gb and Z10 LE

Re: Hide http windows

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="HandheldFriendly" content="true" >
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<title>BB10 Web Audio Test</title>

</head>

<body>
<div id="container">
<button id="play_button" onclick="play(); return false;">Play</button>
</div>

</body>
<script>
var audio = document.createElement('audio');

function play() {
audio.src="http://www.frenchkissfm.com";
audio.play();
}
</script>
</html>

 

I make a sample code but don't work ... where I went wrong?

_______________________________________________

If U like my post click on LIKE :smileywink:
Developer
Zukka
Posts: 201
Registered: ‎05-08-2012
My Device: PlayBook 64 Gb and Z10 LE

Re: Hide http windows

I need to edit a config.xml and insert code?
_______________________________________________

If U like my post click on LIKE :smileywink:
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Hide http windows

For the config.xml I do not know if you need something since I do not know how it looks like.

 

For your sample code:

 

function play() {
audio.src="http://www.frenchkissfm.com";
audio.play();
}

you do not really understand how it works, isn't it? The audio.src needs to get the source of the stream, not the source of your website since it doesn't understand HTML and will not be able to play anything. I think there should be an error output shown in the Web Inspector. I Inspected the page and it seems your stream is available @"stream.frenchkissfm.com:80/;stream.nsv", isn't it?

 

 


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Developer
The_Anomaly
Posts: 322
Registered: ‎08-06-2012
My Device: Dev Alpha / Playbook / Curve 9300

Re: Hide http windows

Your config.xml will need the access element for allowing your app to access the external web content, ie: the stream.

If it helped you, click like. :smileyhappy:
Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Hide http windows

>>I need to edit a config.xml and insert code?

 

Yes, you will need to add an access element to your config.xml document in order to whitelist an external domain.

 

here is the documentation for the <access> element:

https://developer.blackberry.com/html5/documentation/access_element_834677_11.html

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.