小编use*_*002的帖子

1-2秒后暂停youtube视频

我正在使用Youtube Player api在我的应用程序中播放youtube视频.视频在1-2秒后开始播放和暂停

我创建了Video Fragment和ViewGroup.随后我创建了一些youtobe视频.

VideoFragment

public static final class VideoFragment extends YouTubePlayerSupportFragment implements
        OnInitializedListener
{

    private YouTubePlayer player;
    private String videoId;

    public static VideoFragment newInstance()
    {
        return new VideoFragment();
    }

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        initialize(Constants.DEVELOPER_KEY, this);
    }

    @Override
    public void onDestroy()
    {
        if (player != null)
        {
            player.release();
        }
        super.onDestroy();
    }

    public void setVideoId(String videoId)
    {
        if (videoId != null && !videoId.equals(this.videoId))
        {
            this.videoId = videoId;
            if (player != null)
            {
                player.cueVideo(videoId);
            }
        }
    }

    public …
Run Code Online (Sandbox Code Playgroud)

youtube android

7
推荐指数
2
解决办法
3940
查看次数

标签 统计

android ×1

youtube ×1