2

In my project i need to open the url that contain embed audio and video in the same link i try lot of method to open but i cant able to get the output and lot of link for this till it is not clear for this type of problem. I'm using 2.3 version devices

I have used the intent method

  Intent newIntent = new Intent(Intent.ACTION_VIEW, 
            Uri.parse("http://survey.euro.confirmit.com/extwix/test_p1837764731.aspx?__etk=GMYRUFKMQZTQ&ftouch=1679&pin=346"));
            startActivity(newIntent);

and i have used the WebView method also till now i cant get it working

web = (WebView) surveyView.findViewById(R.id.webView_survey);
settings = web.getSettings();
settings.setBuiltInZoomControls(true);
settings.setJavaScriptEnabled(true);
settings.setAllowFileAccess(true);
settings.setPluginsEnabled(true);
settings.setGeolocationEnabled(true);
// settings.setJavaScriptCanOpenWindowsAutomatically(true);
// settings.setSupportMultipleWindows(true);
web.requestFocus(View.FOCUS_DOWN);
web.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
    case MotionEvent.ACTION_UP:
    if (!v.hasFocus()) {
          v.requestFocus();
    }
    break;
    }
    return false;
    }
    });
web.loadUrl("http://survey.euro.confirmit.com/extwix/test_p1837764731.aspx?__etk=GMYRUFKMQZTQ&ftouch=1679&pin=346");
}

can any one help me so solve this problem

Jagan
  • 692
  • 1
  • 12
  • 38

3 Answers3

1

Extract the URL using a suitable HTML Parser, then you can supply the URL to the MediaPlayer object to play your resource.

For Audio you can refer to the Android docs here. The MediaPlayer class has a setDataSource() method that lets you specify an external URI to be played.

For Video, the VideoView class has a setVideoURI() method that can accomplish the same. Maybe going a bit deeper into the docs will yield more answers. :)

varagrawal
  • 2,909
  • 3
  • 26
  • 36
  • but this is embed audio and video URL u can not simple used this url as audio or video in this url there are some content that also must be display – Jagan May 29 '14 at 06:52
  • i need a solution coding for this question can u provide it – Jagan May 29 '14 at 06:53
  • I am not understanding your question. Do you want to get audio/video embedded in another site? Or audio/video provided as URLs? – varagrawal May 29 '14 at 06:55
  • open the url in desktop and c the flow that some flow must come in android device if i used the same url that the question – Jagan May 29 '14 at 06:59
  • http://survey.euro.confirmit.com/extwix/test_p1719865390.aspx?__etk=JFZWRJKESUUD&ftouch=2299&pin=156 and just click the forword button and u will find the audio and video in the url – Jagan May 29 '14 at 07:01
  • Ah, the mp3 url is embedded in the page. You could use an HTML(XML) parser to extract the url and then play it. Pretty straightforward. – varagrawal May 29 '14 at 07:17
  • can u please give me some example for this type of thing bcz i'm new to this – Jagan May 29 '14 at 07:21
  • i cant get you what i'll used in this url u sent – Jagan May 29 '14 at 07:41
  • You can use the HTML parsers in that link to extract the URLs for audio and video. – varagrawal May 29 '14 at 08:00
  • how do i used the HTML parser in this url – Jagan May 29 '14 at 08:04
  • RTFM! If you really can't figure this out, I doubt you'll be able to complete your project, mate. – varagrawal May 29 '14 at 08:07
  • dude can u give me some example for HTML parser so that i can used it in the app – Jagan May 29 '14 at 09:13
0

Problem is with you Url of video.

When you would like to stream the video your url should be explicit like ,

String vidAddress = "https://archive.org/download/ksnn_compilation_master_the_internet/ksnn_compilation_master_the_internet_512kb.mp4";

Please go though this SO answer

Community
  • 1
  • 1
dharmendra
  • 7,835
  • 5
  • 38
  • 71
  • but the url work when v used in the desktop same thing i need to show in the android – Jagan May 29 '14 at 07:44
  • that why i mention it is embed audio and video to open in browser – Jagan May 29 '14 at 07:51
  • you must had open that url in some of the desktop browser then , internet browser manage this thing itself since its one kind of software . and what do you mean by embedded video ? are you targeting HLS streaming ? – dharmendra May 29 '14 at 07:56
  • if u c the inspect element u'll find this coding – Jagan May 29 '14 at 08:01
0

You can use this as reference how to do video streaming in android it helped me with the approach.

Swapnil Kadam
  • 4,075
  • 5
  • 29
  • 35