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
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520
My Carrier: Airtel

Re: To show any other url instead of my own url which I used to play the video in a html5 app for 7.0 OS mobiles

Actually I have parsed the xml.aspx  file whic contains the links / stream Urls which i  use them to play the videos.

 

 

No wI want to play the  original video only but show the usersa different url in the browser addressbar. Is it possible ?

 

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: To show any other url instead of my own url which I used to play the video in a html5 app for 7.0 OS mobiles

Hi there, I just want to ensure I'm understanding correctly. To start, is this HTML5 application being run in the BBOS browser or as a WebWorks application?

 

When you say you parse the xml.aspx, do you mean that you retrieved it via AJAX (XmlHttpRequest)? And then you pulled <video> or <embed> objects out and retrieved the src / video paths for each?

 

If you have the src and the browser is displaying the URL, am I correct that you are navigating to the URL in order to play the video, but want to play the video without changing the URL in the address bar? Depending on the type of URL, you should be able to create / embed / play a <video> object in your page, which would allow you to play a video without navigating elsewhere.

 

If you could add just a little clarification to what you're hoping to accomplish, I'll do my best to help.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520
My Carrier: Airtel

Re: To show any other url instead of my own url which I used to play the video in a html5 app for 7.0 OS mobiles

Yes you rae correct   I have parsed  the xml.aspx, retrieved the contents via   XmlHttpRequest).

 

And then playing the video by pulling .

 

 

But here I want to   hide the actual rtsp url from the users or   Change the url  to any dumy url www.yahoo.com.

 

 

 

My main target is to not to show my actual urls  retrieved from the xml.aspx.

 

 

Thanks

 

 

 

Please use plain text.
Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520
My Carrier: Airtel

Re: To show any other url instead of my own url which I used to play the video in a html5 app for 7.0 OS mobiles

Hi Oros  now are you clear with my query?  Iamw aiting for your help.

 

 

I have replied the the last  reply of yours.

 

 

 

Thanks

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: To show any other url instead of my own url which I used to play the video in a html5 app for 7.0 OS mobiles

I believe so. I'm just not clear on where the URL is actually showing. If you are navigating (i.e. window.location) to the URL then, in a WebWorks application this isn't visible anyways as there is no chrome (address bar, navigation, etc.)

 

If you mean you don't want the code to be visible for hte HTML elements (i.e. your <video> tag and the like) then a WebWorks application doesn't actually let you view the source unless you've explicitly enabled Web Inspector. However if you don't (which is recommended for release builds) then they wouldn' thave a place to see the URL anyways.

 

If you are doing this in the browser, then there is no way to hide your source beyond obfuscation, and any URL that is navigated to will be displayed in the address bar.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520
My Carrier: Airtel

Re: To show any other url instead of my own url which I used to play the video in a html5 app for 7.0 OS mobiles

Yes Iam doing  all these in  the browser .

 

 

Any way to skip or hide the url or the addressbar totally?

 

 

What is ofusction?

 

 

I have built a html5 app with ripple  with blackberry webworks sdk 2.3.1.5 

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: To show any other url instead of my own url which I used to play the video in a html5 app for 7.0 OS mobiles

In the browser, you could request fullscreen mode with the Fullscreen API:

http://updates.html5rocks.com/2011/10/Let-Your-Content-Do-the-Talking-Fullscreen-API

 

However this won't guarantee that everything else is hidden, it's up to the user.

 

Obfuscation refers arranging your code so it's not obvious as to what it's actually doing. Something similar to what minifying does. However this would only affect your actual source code (i.e. if someone views the source in the browser.) It would not affect the URL in the address bar. You can not change the address bar to display something else; for security purposes, in the browser, the user should know what page they're looking at.

 

When you build an app with the WebWorks SDK, the app does not have an address bar, so it should not be an issue there.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520
My Carrier: Airtel

Re: To show any other url instead of my own url which I used to play the video in a html5 app for 7.0 OS mobiles

Yes in my case as my app is a web app based Live TV app  i.e html5 app.

 

 

 

Whenuser clicks on any channel image it is going to the browser and showing the url and then playing the video. I want to avoid it.

 

 

 

 

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: To show any other url instead of my own url which I used to play the video in a html5 app for 7.0 OS mobiles

If I'm understanding correctly, the user is inside a WebWorks app, clicks a link that launches the browser, the browser plays the video, but also displays the URL.

 

If it is simply a link being clicked, example:

<a href="http://www.youtube.com/myvideo" />

 

Then you can add the target="_blank" property to the link. Setting that will cause the link to open a child browser within the actual application' this will not show the navigation bar as the browser is not invoked, but a separate viewer is invoked inside your application.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520
My Carrier: Airtel

Re: To show any other url instead of my own url which I used to play the video in a html5 app for 7.0 OS mobiles

Yes  You are absolutely    right     Thanks oros   you for your reply Can u please implement  ur logic for showing blank  page  in my main.js

 

 

 

var mstep="lang";
var mstep1="";
var mchannels = [];
var highURL = "-----------------------/symbianxml.aspx?bandwidth=Medium";
var lowURL = "-------------------------/symbianxml.aspx?bandwidth=Low";
var wifiURL = "-------------------------/symbianxml.aspx?bandwidth=High";
var finalURL = "";

 function test_fn() {
  
  var channels = mchannels; 
  var markup = "";    
  for(i=0; i < channels.length; i++){  
   var ch=channels[i];   
   if(ch['language']==mstep1) {
    markup += generateHTMLMarkup(i, channels[i]); 
   }  
  } 
  document.getElementById("accordian").innerHTML = markup;
 }

 function generateHTMLMarkup(i, channel){
  alert("this is lang"+str);
  var str ="";
        str +=  "<div class='ui-category-list-item-title-for-Global-Takeof'\">";       
        str +=  "<img class='img_chan'style='margin-top:10px;' src=\"" + channel['image'] + "\"  />" +
                "<a href=\"" + channel['link'] + "\">" + channel['name'].replace("Low",".") + "</a>" + "</div>";
    str += "<div class='ui-list-item'>"+  "<a href=\""+ channel['link']+"\">"+"</a>"+" </div>";
    alert("this is lang"+str); 
        return str;

 }

 

var xmlDataSource = {
 
 URL: "--------------------------------------------------/symbianxml.aspx",
 
 init: function() {   
   //URL, success callback, failure callback   
   this.connect(this.URL, this.responseHandler, this.failureHandler); 
 },  
 
 /**
  * Parses XML document into JS Object array
  * @param xmlDoc XML Document
  * @returns {Array} array of device objects
  */
 parseResponse: function(xmlDoc) {
    
  var chElements = xmlDoc.getElementsByTagName("channel");
   
  var channels = [];
  
  console.log(chElements.length);
  
  for(var i=0; i < chElements.length; i++){ 
    
   var channel = { };
   
   for(var j=0; j < chElements[i].childNodes.length; j++){   
    
    var node = chElements[i].childNodes[j];
            
    if(node.nodeType != 1){ //not an element node
     continue;
    }
       
    channel[node.tagName] =  node.textContent;
   }
   
   channels.push(channel);
  }
  console.log(channels.length);
  mchannels=channels;

  return channels; 
 },
 
 /**
  * Handles the response, and displays device data in web app
  * @param xmlDoc
  */
 responseHandler: function(xmlDoc) {
  
  var channels = this.parseResponse(xmlDoc); 
  var markup = "";
  var lngrow = 0; 
  for(lng=0; lng < channels.length; lng++){  
   //FOR LANGUAGE
   
   if(lng<1){
    markup += this.generateHTMLMarkup1(lngrow, channels[lng]); 
   }else{
    var ch=channels[lng];
    var ch1=channels[lng-1];
    
    if(ch['language']==ch1['language']) {
     
    }else{
     lngrow++;
     markup += this.generateHTMLMarkup1(lngrow, channels[lng]); 
    }   
   } 
  //markup += this.generateHTMLMarkup(i, channels[i]); 
 } 

 document.getElementById("accordian").innerHTML = markup;

 },
 
 /**
  * Generates HTML markup to be inserted in to Web App DOM.
  * @index i, index of the device
  * @param device, device object
  */
 /*
 generateHTMLMarkup: function(i, channel){
  
  var str ="";
  str +=  "<div class='ui-category-list-item-title ui-close' id='item_title_"+i+"'" +
    "onclick=\"mwl.setGroupTarget('#accordian','#items_"+i+"', 'ui-show', 'ui-hide'); " +
    "mwl.setGroupTarget('#accordian','#item_title_"+i+"', 'ui-open', 'ui-close'); return false;\">";  
  str +=  "<img src=\""+ channel['image'] +"\" height=100% align=left />" + channel['name'] +"</div>"; 
  str +=  "<div class='ui-category-list-item-body ui-hide' id='items_"+i+"'>";  
  str +=  "<div class='ui-list'>";
  str +=  "<div class='ui-list-item'>"+ "id: " + channel['id'] +"</div>"; 
  str +=  "<div class='ui-list-item'>"+ "type: " + channel['type'] +"</div>";
  str +=  "<div class='ui-list-item'>"+ "language: " + channel['language'] +"</div>";  
  str +=  "<div class='ui-list-item'>"+ "bandwidth: " + channel['bandwidth'] +"</div>";
  str +=  "<div class='ui-list-item'>"+ "cellnapid: " + channel['cellnapid'] +"</div>";
  str +=  "<div class='ui-list-item'>"+ "link: " + "<a href=\""+ channel['link']+"\">Start video</a> </div>";
  str +=  "</div></div>";
  return str;
 },*/
 generateHTMLMarkup1: function(varlng, channel){  
  //alert(parseInt(varlng));
  var str ="";
        str +=  "<div class='list" + (varlng%2==0?1:2) + "'\"  onclick=\"mstep1='"+channel['language'] + "';showTab();\">"+ channel['language'] +"<img style=\"float:right; margin-top:3px;\" src=\"arrow.png\" width=30 height=30/>"+ "</div>";////Changed test function
  return str;

 },
 generateHTMLMarkup: function(i, channel){
  alert("this is lang"+str);
  var str ="";
        str +=  "<div class='list1'\" >";       
        str +=  "<img class='img_chan' src=\"" + channel['image'] + "\"  />" +
          "<img class='img_chan' src=\"" + channel['image'] + "\"  />" +
                "<a href=\"" + channel['link'] + "\" >" + channel['name'] + "</a>" +
                "<img class='img_chan' src=\"" + channel['image'] + "\"  />" + "</div>";
    str += "<div class='ui-list-item'>"+  "<a href=\""+ channel['link']+"\">" + " </div>";
     alert("this is lang"+str);
        return str;

 },

 
 
 
 failureHandler: function(reason) { 
  document.getElementById("accordian").innerHTML = "Could not get XML document.<br>"+ reason;
 },
 
 /**
  * Retrieves a XML resource in given URL by using XMLHttpRequest.
  * @param url  URL of the XML resource to retrieve
  * @param successCb Called, when the XML resourece is retrieved successfully. Retreived XML Document is passed as argument.
  * @param failCb Called, if something goes wrong. Reason in text format, is passed as argument. 
  */

 connect: function(url, successCb, failCb) {
  
  var xmlhttp = new XMLHttpRequest();
  
  xmlhttp.open("GET", url, true);

  xmlhttp.setRequestHeader("Accept","text/xml,application/xml"); 
  xmlhttp.setRequestHeader("Cache-Control", "no-cache");
  xmlhttp.setRequestHeader("Pragma", "no-cache");
  
  var that = this;
  xmlhttp.onreadystatechange = function() {
   
   if (xmlhttp.readyState ==  4 ){
    
    if(xmlhttp.status == 200){    
     
     if(!xmlhttp.responseXML){  
      try {
       //In case server didn't respond with correct MIME type for a XML file.
       var domParser= new DOMParser();
       var xmlDoc = domParser.parseFromString(xmlhttp.responseText,"text/xml");
       
       successCb.call(that,xmlDoc);
       
      } catch (e) {
       failCb.call(that,"Response was not in a XML format."); 
      }
          
     }else{      
      successCb.call(that,xmlhttp.responseXML);     
     }       
    }else{    
     failCb.call(that,"Connection failed: Status "+xmlhttp.status);
    }
   }
  };
  xmlhttp.send();
 } 
}; 

function showTab(){
 document.getElementById("tabs").style.display = "block";
 document.getElementById("headertext").innerHTML = "Please Select your desired bandwidth";
 document.getElementById("accordian").innerHTML = "";
 LoadParser();
}
function hideTab(){
 document.getElementById("tabs").style.display = "none";
 document.getElementById("headertext").innerHTML = "Please select your desired Language";
 document.getElementById("accordian").innerHTML = "";
 LoadParser();
}
function hideText(){
 //document.getElementById("headertext").style.display = "none";
 /*document.getElementById("headertext").innerHTML = "";*/
 LoadParser();
}
function showText(){
 //document.getElementById("headertext").style.display = "";
 /*document.getElementById("headertext").innerHTML = "";*/
 LoadParser();
}
function LoadParser(quality){
  if(quality==="3g"){
   finalURL = highURL;
  }else if(quality==="wifi"){
   finalURL = wifiURL;
  }else{
   finalURL = lowURL;
  }
  //alert(finalURL);
 
 xmlHttp = new XMLHttpRequest();
 xmlHttp.onreadystatechange=parseXML;
 xmlHttp.open("GET",finalURL,true);
 xmlHttp.send();
}

function parseXML()
{
  if(xmlHttp.readyState==4 && xmlHttp.status==200)
  {
   var str ="";
   var output = xmlHttp.responseText;
   parser=new DOMParser();
   xmlDoc=parser.parseFromString(output,"text/xml");
  
   var items = xmlDoc.getElementsByTagName("channel");
   if(items.length>0){
   for(i=0;i<items.length;i++){
     if(items[i].getElementsByTagName("language")[0].childNodes[0].nodeValue==mstep1){
   //alert(items[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);
      
        str +=  "<div class='list" + (i%2==0?1:2) + "'\">";       
        str +=  "<img class='img_chan' style='margin:10px 0px; float:left;' src=\"" + items[i].getElementsByTagName("image")[0].childNodes[0].nodeValue + "\"  />" +
                "<a class='link_fon' href=\"" + items[i].getElementsByTagName("link")[0].childNodes[0].nodeValue + "\">" +items[i].getElementsByTagName("name")[0].childNodes[0].nodeValue.replace("Low","").replace("Medium","").replace("High","") + "</a>" + "<img style=\"float:right; margin-top:30px;\" src=\"arrow.png\" width=30 height=30/>"+ "</div>";
    str += "<div class='ui-list-item'>"+   "<a href=\""+ items[i].getElementsByTagName("link")[0].childNodes[0].nodeValue+"\">"+" </div>";
     
        /*alert("@@@@@@@2"+str);*/
     }//if select according to language
    }//for iteration 
    document.getElementById("accordian").innerHTML= str;
   }//if length
  }// if status
}
 

 

Pleasee implement   

 

target="_blank" property to the link

 

 

Please use plain text.