首页 > 解决方案 > Flutter - How to have audio play when phone screen is off

问题描述

I am building an app where there is a person is speaking, kinda like a podcast, and I would like the listener to be able to listen when the screen is off.

I am using Flutter, and the media player is complete, but if i turn the phone screen off, the media stops.

I have no idea how to treat this so when you turn off the screen, the media will still play.

标签: dartflutteraudio-streamingflutter-dependencies

解决方案


您需要使用后台服务插件。我推荐此处提供的 audio_services 插件:https ://pub.dev/packages/audio_service#-installing-tab-插件描述的截图。 祝你好运


推荐阅读