How to get RTSP URL?

后端 未结 3 766
无人及你
无人及你 2020-12-09 14:32

I am Developing an application which consists of video-view,Here is my problem

  1. when I have loaded normal url is not working,The URL of Youtube
  2. How
3条回答
  •  不思量自难忘°
    2020-12-09 15:00

    Actual what i did was: code here

    if (responseCode == HttpURLConnection.HTTP_OK) { 
                          InputStream in = httpConnection.getInputStream(); 
    
                          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                          DocumentBuilder db = dbf.newDocumentBuilder();
    
                          Document dom = db.parse(in);      
                          Element docEle = dom.getDocumentElement();
    
                          NodeList nl = docEle.getElementsByTagName("entry");
                          if (nl != null && nl.getLength() > 0) {
                            for (int i = 0 ; i < nl.getLength(); i++) {
                              Element entry = (Element)nl.item(i);
                              Element title = (Element)entry.getElementsByTagName("title").item(0);
    
                              String titleStr = title.getFirstChild().getNodeValue();
    
                              Element content = (Element)entry.getElementsByTagName("content").item(0);
                              String contentStr = content.getAttribute("src");
    
                              Element rsp = (Element)entry.getElementsByTagName("media:content").item(1);
    
                              String anotherurl=rsp.getAttribute("url");
    
                             // System.out.println("content uri"+anotherurl);
    
                              Element photoUrl = (Element)entry.getElementsByTagName("media:thumbnail").item(0);
                              String photoStr = photoUrl.getAttribute("url");
    
    
                              JSONObject temp = new JSONObject();
                              try {
                                temp.put("Title", titleStr);
                                temp.put("Content", contentStr);
                                temp.put("PhotoUrl", photoStr);
                                temp.put("VideoUrl", anotherurl);
                              } catch (JSONException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                              }
    
                              collection.put(temp);
    
                              //VideoCell cell = new VideoCell(titleStr);
                            }
                          }
                        }
    

    Here string named anotherurl is the url you looking for rtsp url.

    Hope it helps.

提交回复
热议问题