MP3 -Dateien in Beeware abspielt < / p>
Hallo, ich experimentiere mit Python / Beeware / Toga / Android. Ich möchte eine MP3 -Datei öffnen. < /P>
Der erste Teil funktioniert: < /p>
async def pate_tlacitko(self, widget):
from toga.platform import current_platform
if current_platform == "android":
from android.content import Intent
from android.net import Uri
from java.io import File
intent = Intent(Intent.ACTION_MAIN)
intent.addCategory(Intent.CATEGORY_APP_MUSIC)
await self.app._impl.intent_result(intent)
< /code>
Nach dem Aufrufen der Funktion erhalte ich die Auswahl der Anwendung, um den Sound abzuspielen. async def pate_tlacitko(self, widget):
from toga.platform import current_platform
if current_platform == "android":
from android.content import Intent
from android.net import Uri
from java.io import File
intent = Intent(Intent.ACTION_MAIN)
intent.addCategory(Intent.CATEGORY_APP_MUSIC)
intent.setDataAndType(Uri.fromFile(File(str("resources/test.mp3"))), "application/mp3")
await self.app._impl.intent_result(intent)
←[33mW/python.stderr: android.os.FileUriExposedException: file:///resources/test.mp3 exposed beyond app through Intent.getData()←[0m
< /code>
Wie definiere ich eine Datei zum Spielen? Idealerweise wäre es, eine Datei aus dem Musikverzeichnis abzuspielen.
thx
MP3 -Dateien in Beeware abspielen ⇐ Android
-
- Similar Topics
- Replies
- Views
- Last post