一旦是视频app在同一个activity中运行媒体会话和媒体控制器,媒体会话回调的实现与音频应用server/client 架构实现的回调不同。由于没有服务的调用,所以notification都是由NotificationManager来控制的。下面的列表展示两种回调函数中不同的控制方式。
_onPlay()onPause()onStop()
Audio FocusrequestFocus() passing in your OnAudioFocusChangeListener. Always call requestFocus() first, proceed only if focus is granted.abandonAudioFocus()Media SessionsetActive(true) - Update metadata and state-Update metadata and statesetActive(false) - Update metadata and statePlayer ImplementationStart the playerPause the playerStop the playerBecoming NoisyRegister your BroadcastReceiverUnregister your BroadcastReceiverNotificationsShow notificationUpdate notificationCancel notification
转载请注明原文地址: https://ju.6miu.com/read-663049.html