Jak udostępnić parametry początkowe i końcowe wideo YouTube na odtwarzaczu Android w YouTube?
Korzystam z aplikacji Youtube Player api do odtwarzania filmów na youtube w mojej aplikacji. Chcę rozpocząć wideo od przypuszczalnie 36 sekund i chce zakończyć ten film około 65 sekund.
przykład:https://www.youtube.com/v/BmOpD46eZoA?start=36&end=65
Używam youtubeAndroidPlayer Api. Nie znalazłem żadnych metod dla Youtubeplayer, aby ustawić wartości początkowe i końcowe. Czy ktoś mógłby zasugerować, jak mogę ustawić parametry.
Chcę też, aby kontrolki były ukrywane za pomocą pola „control” w youtube api, ale nie znalazłem żadnych metod, aby to ukryć.
mój xml:
<LinearLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="http://android-er.blogspot.com/"
android:textStyle="bold"
android:layout_gravity="center_horizontal"
android:autoLink="web" />
<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/youtubeplayerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
Moja aktywność:
public class MainActivity extends YouTubeBaseActivity implements
YouTubePlayer.OnInitializedListener{
public static final String API_KEY = "AIzaSyCe6tORd9Ch4lx-9Ku5SQ476uS9OtZYsWA";
public static final String VIDEO_ID = "xyoajjlPt_o";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
YouTubePlayerView youTubePlayerView = (YouTubePlayerView)findViewById(R.id.youtubeplayerview);
youTubePlayerView.initialize(API_KEY, this);
}
@Override
public void onInitializationFailure(Provider provider,
YouTubeInitializationResult result) {
Toast.makeText(getApplicationContext(),
"onInitializationFailure()",
Toast.LENGTH_LONG).show();
}
@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer player,
boolean wasRestored) {
if (!wasRestored) {
player.cueVideo(VIDEO_ID);
}
}