【问题标题】:How to Play YouTubePlayList Intent videos in Full Screen如何全屏播放 YouTubePlayList Intent 视频
【发布时间】:2016-10-21 14:05:16
【问题描述】:

我是 android 的初学者,我正在开发一个应用程序,我在其中使用 YouTube 数据 API 来显示特定播放列表的 YouTube 视频。我这样做是成功的,但是有一个问题是,每当用户单击该播放列表中的任何视频时,该视频都会默认播放 YouTube 视频在 YouTube 应用程序中播放。我希望每当用户点击任何视频时,它都应该在设备 YouTube 应用中全屏播放 各种帮助表示赞赏! 这是我的主要活动代码:

    package com.example.pc.fkidshell;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;

import com.google.android.youtube.player.YouTubeIntents;

public class Main4Activity extends AppCompatActivity {
    Toolbar third_toolbar;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main4);
        third_toolbar = (Toolbar) findViewById(R.id.my_thirdtoolbar);
        setSupportActionBar(third_toolbar);
        getSupportActionBar().setTitle(R.string.sectitle);
        getSupportActionBar().setIcon(R.drawable.tblogo);
        OnClickButtonListener();
    }
    public void OnClickButtonListener()
    {
        Button youtubebtn = (Button) findViewById(R.id.button8);
        youtubebtn.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                String PLAYLIST_ID = "PLXRActLQ03oY_6AQb-5EMuKFYQA_fDE40";
                Intent intent = YouTubeIntents.createPlayPlaylistIntent(Main4Activity.this, PLAYLIST_ID);
                startActivity(intent);

            }
        }
        );
    }
}

【问题讨论】:

    标签: android


    【解决方案1】:

    force_fullscreen 的多余部分传递为true

    intent.putExtra("force_fullscreen",true); 
    

    向您推荐另一个答案:

    https://stackoverflow.com/a/14064588/4434834

    【讨论】:

    • 这仅适用于 YouTubeIntents.createPlayVideoIntent() 不适用于 YouTubeIntents.createOpenPlaylistIntent(Main4Activity.this, PLAYLIST_ID)
    猜你喜欢
    • 2010-12-07
    • 1970-01-01
    • 1970-01-01
    • 2020-04-11
    • 1970-01-01
    • 1970-01-01
    • 2018-08-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多