• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SubtitleLayout类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.exoplayer.text.SubtitleLayout的典型用法代码示例。如果您正苦于以下问题:Java SubtitleLayout类的具体用法?Java SubtitleLayout怎么用?Java SubtitleLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SubtitleLayout类属于com.google.android.exoplayer.text包,在下文中一共展示了SubtitleLayout类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreateOverlayView

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
@Override
public View onCreateOverlayView() {
    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    mSubtitleView = (SubtitleLayout) inflater.inflate(R.layout.subtitleview, null);

    // Configure the subtitle view.
    CaptionStyleCompat captionStyle;
    float captionTextSize = getCaptionFontSize();
    captionStyle = CaptionStyleCompat
            .createFromCaptionStyle(mCaptioningManager.getUserStyle());
    captionTextSize *= mCaptioningManager.getFontScale();
    mSubtitleView.setStyle(captionStyle);
    mSubtitleView.setFixedTextSize(TEXT_UNIT_PIXELS, captionTextSize);
    mSubtitleView.setVisibility(View.VISIBLE);

    return mSubtitleView;
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:18,代码来源:RichTvInputService.java


示例2: configureSubtitleView

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
private void configureSubtitleView() {
	CaptionStyleCompat style;
	float fontScale;
	if (Util.SDK_INT >= 19) {
		style = getUserCaptionStyleV19();
		fontScale = getUserCaptionFontScaleV19();
	} else {
		style = CaptionStyleCompat.DEFAULT;
		fontScale = 1.0f;
	}
	subtitleLayout.setStyle(style);
	subtitleLayout.setFractionalTextSize(SubtitleLayout.DEFAULT_TEXT_SIZE_FRACTION * fontScale);
}
 
开发者ID:vuthanhict,项目名称:ExoPlayerController,代码行数:14,代码来源:PlayerActivity.java


示例3: configureSubtitleView

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
private void configureSubtitleView() {
    CaptionStyleCompat style;
    float fontScale;
    if (Util.SDK_INT >= 19) {
        style = getUserCaptionStyleV19();
        fontScale = getUserCaptionFontScaleV19();
    } else {
        style = CaptionStyleCompat.DEFAULT;
        fontScale = 1.0f;
    }
    subtitleLayout.setStyle(style);
    subtitleLayout.setFractionalTextSize(SubtitleLayout.DEFAULT_TEXT_SIZE_FRACTION * fontScale);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:14,代码来源:PlayerActivity.java


示例4: onCreate

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_video_player);
    View root = findViewById(R.id.root);
    root.setOnTouchListener((view, motionEvent) -> {
        if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
            toggleControlsVisibility();
        } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
            view.performClick();
        }
        return true;
    });
    root.setOnKeyListener((v, keyCode, event) -> !(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE
            || keyCode == KeyEvent.KEYCODE_MENU) && mediaController.dispatchKeyEvent(event));

    shutterView = findViewById(R.id.shutter);

    videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
    surfaceView = (SurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    subtitleLayout = (SubtitleLayout) findViewById(R.id.subtitles);

    mediaController = new KeyCompatibleMediaController(this);
    mediaController.setAnchorView(root);

    CookieHandler currentHandler = CookieHandler.getDefault();
    if (currentHandler != defaultCookieManager) {
        CookieHandler.setDefault(defaultCookieManager);
    }

    audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this);
    audioCapabilitiesReceiver.register();
}
 
开发者ID:konifar,项目名称:droidkaigi2016,代码行数:37,代码来源:VideoPlayerActivity.java


示例5: configureSubtitleView

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
private void configureSubtitleView() {
    CaptionStyleCompat captionStyle;
    float fontScale;
    if (Util.SDK_INT >= 19) {
        captionStyle = getUserCaptionStyleV19();
        fontScale = getUserCaptionFontScaleV19();
    } else {
        captionStyle = CaptionStyleCompat.DEFAULT;
        fontScale = 1.0f;
    }
    subtitleLayout.setStyle(captionStyle);
    subtitleLayout.setFractionalTextSize(SubtitleLayout.DEFAULT_TEXT_SIZE_FRACTION * fontScale);
}
 
开发者ID:cklar,项目名称:ExoPlayerWrapper,代码行数:14,代码来源:SimpleVideoPlayer.java


示例6: attachSurfaceViewToPlayer

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
@Override
public void attachSurfaceViewToPlayer() {
    if (prepareWithConfigurationMode) {
        LOGD(TAG, "KExoPlayer attachSurfaceViewToPlayer " + prepareWithConfigurationMode);
        LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, Gravity.CENTER);
        this.addView(mSurfaceView, layoutParams);
        mSubtView = new com.google.android.exoplayer.text.SubtitleLayout(getContext());
        this.addView(mSubtView, layoutParams);
    }
}
 
开发者ID:kaltura,项目名称:player-sdk-native-android,代码行数:11,代码来源:KExoPlayer.java


示例7: configureSubtitleView

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
private void configureSubtitleView() {
    CaptionStyleCompat style;
    float fontScale;
    if (Util.SDK_INT >= 19) {
        style = getUserCaptionStyleV19();
        fontScale = getUserCaptionFontScaleV19();
    } else {
        style = CaptionStyleCompat.DEFAULT;
        fontScale = 1.0f;
    }
    if (mSubtView != null) {
        mSubtView.setStyle(style);
        mSubtView.setFractionalTextSize(SubtitleLayout.DEFAULT_TEXT_SIZE_FRACTION * fontScale);
    }
}
 
开发者ID:kaltura,项目名称:player-sdk-native-android,代码行数:16,代码来源:KExoPlayer.java


示例8: onCreate

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
// TODO:
//		setContentView(R.layout.player_activity);
		setContentView(R.layout.player_activity_two);
		root = findViewById(R.id.root);
		root.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View view, MotionEvent motionEvent) {
				if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
					toggleControlsVisibility();
				} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
					view.performClick();
				}
				return true;
			}
		});
		root.setOnKeyListener(new OnKeyListener() {
			@Override
			public boolean onKey(View v, int keyCode, KeyEvent event) {
				if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE
						|| keyCode == KeyEvent.KEYCODE_MENU) {
					return false;
				}
				// TODO: return mediaController.dispatchKeyEvent(event);
				return goatMediaController.dispatchKeyEvent(event);
			}
		});

		shutterView = findViewById(R.id.shutter);
		debugRootView = findViewById(R.id.controls_root);

		videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
		surfaceView = (SurfaceView) findViewById(R.id.surface_view);
		surfaceView.getHolder().addCallback(this);
		debugTextView = (TextView) findViewById(R.id.debug_text_view);

		playerStateTextView = (TextView) findViewById(R.id.player_state_view);
		subtitleLayout = (SubtitleLayout) findViewById(R.id.subtitles);
		// TODO:
		// mediaController = new MediaController(this);
		// mediaController.setAnchorView(root);
		goatMediaController = (GoatMediaController) findViewById(R.id.media_controller);
		retryButton = (Button) findViewById(R.id.retry_button);
		retryButton.setOnClickListener(this);
		videoButton = (Button) findViewById(R.id.video_controls);
		audioButton = (Button) findViewById(R.id.audio_controls);
		textButton = (Button) findViewById(R.id.text_controls);

		CookieHandler currentHandler = CookieHandler.getDefault();
		if (currentHandler != defaultCookieManager) {
			CookieHandler.setDefault(defaultCookieManager);
		}

		audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this);
		audioCapabilitiesReceiver.register();
		
		getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(this);
	}
 
开发者ID:vuthanhict,项目名称:ExoPlayerController,代码行数:61,代码来源:PlayerActivity.java


示例9: onCreate

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.player_activity);
    View root = findViewById(R.id.root);
    root.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
                toggleControlsVisibility();
            } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
                view.performClick();
            }
            return true;
        }
    });
    root.setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE
                    || keyCode == KeyEvent.KEYCODE_MENU) {
                return false;
            }
            return mediaController.dispatchKeyEvent(event);
        }
    });

    shutterView = findViewById(R.id.shutter);
    debugRootView = findViewById(R.id.controls_root);

    videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
    surfaceView = (SurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);
    debugTextView = (TextView) findViewById(R.id.debug_text_view);

    playerStateTextView = (TextView) findViewById(R.id.player_state_view);
    subtitleLayout = (SubtitleLayout) findViewById(R.id.subtitles);

    mediaController = new KeyCompatibleMediaController(this);
    mediaController.setAnchorView(root);
    retryButton = (Button) findViewById(R.id.retry_button);
    retryButton.setOnClickListener(this);
    videoButton = (Button) findViewById(R.id.video_controls);
    audioButton = (Button) findViewById(R.id.audio_controls);
    textButton = (Button) findViewById(R.id.text_controls);

    CookieHandler currentHandler = CookieHandler.getDefault();
    if (currentHandler != defaultCookieManager) {
        CookieHandler.setDefault(defaultCookieManager);
    }

    audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this);
    audioCapabilitiesReceiver.register();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:56,代码来源:PlayerActivity.java


示例10: VideoPlayerView

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
public VideoPlayerView(Context context, PlaybackControls controller, View root) {
    mContext = context;
    mediaController = controller;
    shutterView = root.findViewById(R.id.shutter);
    videoFrame = (AspectRatioFrameLayout) root.findViewById(R.id.video_frame);
    surfaceView = (SurfaceView) root.findViewById(R.id.surface_view);
    debugTextView = (TextView) root.findViewById(R.id.debug_text_view);
    debugView = root.findViewById(R.id.debug_view);
    statusTextView = (TextView) root.findViewById(R.id.status);
    playerStateTextView = (TextView) root.findViewById(R.id.player_state_view);
    subtitleLayout = (SubtitleLayout) root.findViewById(R.id.subtitles);
    nextEpisodeCard = root.findViewById(R.id.next_episode_card);
    episodeDetails = root.findViewById(R.id.episode_details);
    episodeTitle = (TextView) root.findViewById(R.id.episode_title);
    seriesTitle = (TextView) root.findViewById(R.id.series_title);
    duration = (TextView) root.findViewById(R.id.duration);

    ImageCardView card = (ImageCardView) root.findViewById(R.id.next_episode);
    card.setFocusable(true);
    card.setFocusableInTouchMode(true);
    card.setInfoVisibility(View.VISIBLE);
    card.setExtraVisibility(View.VISIBLE);
    card.setInfoAreaBackgroundColor(context.getResources().getColor(R.color.black_900));
    Point size = new Point(context.getResources().getDimensionPixelSize(R.dimen.card_width),
            context.getResources().getDimensionPixelSize(R.dimen.card_height));
    nextEpisode = new EpisodeCardView(context, card, size, false);
    nextEpisode.getImageCardView().setCardType(BaseCardView.CARD_TYPE_INFO_OVER);

    debugView.setVisibility(View.GONE);

    root.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            return handleTouchEvents(view, motionEvent);
        }
    });
    root.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            return handleKeyEvents(v, keyCode, event);
        }
    });
}
 
开发者ID:nextux,项目名称:sbs-android-tv,代码行数:44,代码来源:VideoPlayerView.java


示例11: bindView

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
private void bindView(FrameLayout oldRoot) {
    @SuppressLint("InflateParams")
    ViewGroup root = (ViewGroup) activity.getLayoutInflater().inflate(R.layout.player_view_layout, null);
    ViewGroupUtils.replaceView(oldRoot, root);

    root.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
                toggleControlsVisibility();
            } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
                view.performClick();
            }
            return true;
        }
    });
    root.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU) {
                return false;
            }
            return mediaController.dispatchKeyEvent(event);
        }
    });

    audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(activity.getApplicationContext(),
            this);

    shutterView = root.findViewById(R.id.shutter);

    videoFrame = (AspectRatioFrameLayout) root.findViewById(R.id.video_frame);
    surfaceView = (SurfaceView) root.findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    subtitleLayout = (SubtitleLayout) root.findViewById(R.id.subtitles);

    mediaController = new VideoControllerView(activity, false);
    mediaController.setAnchorView(root);


    CookieHandler currentHandler = CookieHandler.getDefault();
    if (currentHandler != defaultCookieManager) {
        CookieHandler.setDefault(defaultCookieManager);
    }

}
 
开发者ID:cklar,项目名称:ExoPlayerWrapper,代码行数:48,代码来源:SimpleVideoPlayer.java


示例12: prepare

import com.google.android.exoplayer.text.SubtitleLayout; //导入依赖的package包/类
private void prepare() {
    if (mReadiness != KState.IDLE) {
        LOGD(TAG, "Already preparing");
        return;
    }

    mReadiness = KState.PREPARING;

    boolean offline = mSourceURL.startsWith("file://");
    mDrmCallback = new KPlayerExoDrmCallback(getContext(), offline);
    Video video = new Video(mSourceURL, getVideoType());
    final ExoplayerWrapper.RendererBuilder rendererBuilder = RendererBuilderFactory
            .createRendererBuilder(getContext(), video, mDrmCallback);

    mSurfaceView = new VideoSurfaceView(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, Gravity.CENTER);
    mExoPlayer = new ExoplayerWrapper(rendererBuilder);
    Surface surface = mSurfaceView.getHolder().getSurface();
    if (surface != null) {
        mExoPlayer.setSurface(surface);
    }

    mExoPlayer.setCaptionListener(this);
    mExoPlayer.setMetadataListener(this);

    configureSubtitleView();
    mExoPlayer.addListener(this);
    mExoPlayer.prepare();

    mSurfaceCallback = new SurfaceHolder.Callback() {

        @Override
        public void surfaceCreated(SurfaceHolder holder) {
            if (mExoPlayer != null && mExoPlayer.getSurface() == null) {
                mExoPlayer.setSurface(holder.getSurface());
                mReadiness = KState.READY;
                mExoPlayer.addListener(KExoPlayer.this);
            }
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
            LOGD(TAG, "surfaceChanged(" + format + "," + width + "," + height + ")");
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {
            LOGD(TAG, "surfaceDestroyed");
            if (mExoPlayer != null) {
                mExoPlayer.blockingClearSurface();
                mExoPlayer.removeListener(KExoPlayer.this);
            }
        }
    };

    mSurfaceView.getHolder().addCallback(mSurfaceCallback);
    LOGD(TAG, "KExoPlaer prepareWithConfigurationMode " + prepareWithConfigurationMode);
    if(!prepareWithConfigurationMode) {
        this.addView(mSurfaceView, layoutParams);
        mSubtView = new com.google.android.exoplayer.text.SubtitleLayout(getContext());
        this.addView(mSubtView, layoutParams);
    }
}
 
开发者ID:kaltura,项目名称:player-sdk-native-android,代码行数:64,代码来源:KExoPlayer.java



注:本文中的com.google.android.exoplayer.text.SubtitleLayout类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ThreadPoolImpl类代码示例发布时间:2022-05-22
下一篇:
Java SVNErrorCode类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap