0

I have follows below xml feed:

<videourl>
 <iframe src="http://www.youtube.com/embed/cHM0sm6aFtM?fs=0" width="500" height="298" frameborder="0" allowfullscreen="false" ></iframe >
  </videourl>

Here how can i play video ???

i have wrote the below code:

  VideoView mVideo = new VideoView(this);
     mVideo.setLayoutParams(videoLayoutParams);
     mVideo.setVideoURI(Uri.parse("http://www.bogotobogo.com/Video/sample.3gp"));
     MediaController mc = new MediaController(this);
     mVideo.setMediaController(mc);
  mVideo.requestFocus();
     mVideo.start();

Here the video is play well..

But i have add these code

 mVideo.setVideoURI(Uri.parse(Appscontent.Sub_arraylistvideosub.get(j)));

after run the app means the app is force closed.

EDIT:

Yes i have used SAX parser here:

  if (localName.equalsIgnoreCase("videourl")) {
     isVideos = true;
        } 

      if (localName.equalsIgnoreCase("iframe")) {
      if (isVideos)
       {
     String videosurl = attributes.getValue("src");
      sitesList.setVideos(videosurl);
      System.out.println("video value----->"+n+att_ID+"------>>"+videosurl);
      String Sub_arry=n+videosurl;
       Appscontent.Sub_arraylistvideo.add(Sub_arry);
       }} 

Now i have to run the app means am getting the force clsoed error.how can i resolve these...please provide me solution for these ???

Which means am getting the app is force closed..why my app is force closed.please give me solution for these ???

4

1 回答 1

0

使用JDOM,您可以从 XML 中取出链接。

SAXBuilder saxBuilder = new SAXBuilder();
Document document = saxBuilder.build("url to the xml feed");
Element root = document.getRootElement();
Element iframeElement = root.getChild("iframe");
String youtubeUrl = iframeElement.getAttributeValue("src");

然后您可以使用 youtubeUrl 显示视频: mVideo.setVideoURI(Uri.parse(youtubeUrl));

于 2013-03-07T10:35:46.633 回答