asMediaControlContext

fun MediaServiceApi.asMediaControlContext(viewModelScope: CoroutineScope): MediaControlContext

Use a MediaServiceApi to obtain a MediaControlContext to use on MediaControls. The given viewModelScope should be attached to a LifecycleViewModel: it is necessary for MediaControls to perform asynchronous operations.