youtube api startseconds在android默认浏览器中不起作用

时间:2014-01-07 09:35:02

标签: android youtube-api android-youtube-api

我想在我的网页浏览中加载YouTube视频。这就是我这样做的方式

我的网址:http://xx.xxx.xxx/dev_bloopit/youtube3_android.html?videoid=RRzUJSLev1E&ctrl=1&height=250&st=10&en=20

st = 10,en = 20是开始和结束秒数(此YouTube视频将播放10秒,结束时间为20秒)

我的代码:

的xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   tools:context=".MainActivity" >

   <WebView
       android:layout_width="fill_parent"
       android:layout_height="300dp"
       android:layout_centerVertical="true"
       android:layout_centerInParent="true"
       android:background="#000000"
       android:id="@+id/webview1" />   
</RelativeLayout>

代码:

mWebview=(WebView)findViewById(R.id.webview1);

mWebview.getSettings().setJavaScriptEnabled(true);
mWebview.getSettings().setPluginsEnabled(true);

Log.e("Status", "tried url");
mWebview.loadUrl(videoPath);  
mWebview.setWebChromeClient(new WebChromeClient());

这里我给出了startseconds为10和endseconds为20,它在系统浏览器中运行良好。 但是在进入Android默认浏览器时,只有endseconds正在运行。

我的视频播放时间为0秒,尽管我已经开始= 10秒。我认为这是Youtube api的一个错误。 我想知道如何解决这个问题。

0 个答案:

没有答案