gpt4 book ai didi

android - media.session.MediaController 和 android.widget.MediaController 有什么区别?

转载 作者:行者123 更新时间:2023-11-30 01:26:39 25 4
gpt4 key购买 nike

我正在为 VideoView 使用“android.widget.MediaController”。不确定何时使用“android.media.session.MediaController”以及它们之间的区别。任何想法?

MediaController mediaController = new MediaController(this);
videoView.setMediaController(mediaController);
videoView.start();

最佳答案

文档很好地解释了差异。一个是为媒体播放器提供控件的 View ;另一个是与正在进行的媒体 session 交互的对象。

android.widget.MediaController 的描述:

A view containing controls for a MediaPlayer. Typically contains the buttons like "Play/Pause", "Rewind", "Fast Forward" and a progress slider. It takes care of synchronizing the controls with the state of the MediaPlayer.

android.media.session.MediaController 的描述:

Allows an app to interact with an ongoing media session. Media buttons and other commands can be sent to the session. A callback may be registered to receive updates from the session, such as metadata and play state changes.

关于android - media.session.MediaController 和 android.widget.MediaController 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36344864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com