Android WebView resize default audio player -
i using webview in application giving audio url.
its working absolutely fine in devices. see below screenshot:
but in device not looking user friendly.
is there way set size of webview audio player?
update: code snippet:
// open doi activity
intent podcastintent = new intent(mcontext, doiwebactivity.class); podcastintent.setaction(constants.intent_view_link); podcastintent.putextra(constants.extra_doi_link_url, podcasts.get(0).getpodcastlink()); podcastintent.putextra(constants.calling_fragment,constants.calling_fragment_podcast_listing); podcastintent.putextra(constants.extra_podcast_name,mcontext.getstring(r.string.podcast)); mcontext.startactivity(podcastintent);
//called podcastlistingfragment : podcast name
if (bundle != null && bundle.containskey(constants.calling_fragment) && bundle.containskey(constants.extra_podcast_name)) { string title = bundle.getstring(silverchairconstants.extra_podcast_name); } if (utility.isnetworkavailable(mactivity)) { /** * showing external link. */ mwebview.loadurl(mintenttext); } else { networknotavailable(); }
xml:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" tools:context=".fragments.webfragment"> <webview android:layout_below="@+id/toolbar" android:id="@+id/wv_webcontainer" android:layout_width="match_parent" android:layout_height="match_parent" /> <!--progress bar--> <include layout="@layout/silverchair_progress" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_aligntop="@id/wv_webcontainer" android:layout_alignbottom="@id/wv_webcontainer"/> <include layout="@layout/empty_view" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_centerinparent="true" /> </relativelayout>
add line in code initializing webview. mwebview.getsettings().setpluginstate(websettings.pluginstate.on);
if have done recommend use mediaplayer straming.
mediaplayer mediaplayer = mediaplayer.create(this, uri.parse("http://vprbbc.streamguys.net:80/vprbbc24.mp3")); mediaplayer.start();
see answer more details mediaplayer streaming.
Comments
Post a Comment