如何将音频YouTubeAndroidPlayerAPI静音?

时间:2017-05-10 06:53:35

标签: android audio youtube youtube-api

我想静音YouTube Android Player API的音量我已经使用了YouTubePlayerFragment,而我把自定义ImageView放在上面它显示错误`

  

YouTubeAndroidPlayerAPI

:由于播放器顶部未经授权的覆盖,YouTube视频播放停止了。所以我如何将按钮设置为静音音频是否有人可以帮助我?

youTubePlayerSupportFragment.initialize(API_KEY, new com.google.android.youtube.player.YouTubePlayer.OnInitializedListener() {
                    @Override
                    public void onInitializationSuccess(final com.google.android.youtube.player.YouTubePlayer.Provider provider, com.google.android.youtube.player.YouTubePlayer youTubePlayer, boolean b) {
                        mTubePlayer = youTubePlayer;
                        mTubePlayer.setPlayerStyle(com.google.android.youtube.player.YouTubePlayer.PlayerStyle.MINIMAL);
                        mTubePlayer.setManageAudioFocus(true);
                        if (ytInit.size() - 1 > linearLayoutManager.findFirstVisibleItemPosition())
                            mTubePlayer.cueVideo(strings.get(linearLayoutManager.findFirstVisibleItemPosition()), ytInit.get(linearLayoutManager.findFirstVisibleItemPosition()));
                        else
                            mTubePlayer.cueVideo(strings.get(linearLayoutManager.findFirstVisibleItemPosition()));
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                if (mTubePlayer != null) {
                                    showEpisodeThumbnail.setVisibility(View.GONE);
                                    prg.setVisibility(View.GONE);
                                    mTubePlayer.play();
                                    frm.setVisibility(View.VISIBLE);
                                }
                            }
                        }, 1000);

                    }

                    @Override
                    public void onInitializationFailure(com.google.android.youtube.player.YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {

                    }
                });

1 个答案:

答案 0 :(得分:0)

我得到了答案youtube没有提供任何设施来静音我使用自定义iframe播放器的API