[podcast] Fix Audio Playback on Windows and Linux (#182)

Fix the audio playback on Windows and Linux for the podcast player by
adding the missing initialization for `JustAudioMediaKit`.
This commit is contained in:
Rico Berger
2024-08-06 08:45:15 +03:00
committed by GitHub
parent 4853eeb0a8
commit 280a222210
2 changed files with 7 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:just_audio_background/just_audio_background.dart';
import 'package:just_audio_media_kit/just_audio_media_kit.dart';
import 'package:media_kit/media_kit.dart';
import 'package:provider/provider.dart';
import 'package:window_manager/window_manager.dart';
@@ -50,6 +51,7 @@ void main() async {
/// Initialize the [media_kit] packages, so that we can play audio and video
/// files.
MediaKit.ensureInitialized();
JustAudioMediaKit.ensureInitialized();
/// Initialize the [just_audio_background] package, so that we can play audio
/// files in the background.

View File

@@ -90,6 +90,11 @@ set_target_properties(${BINARY_NAME}
# them to the application.
include(flutter/generated_plugins.cmake)
# Replace the default memory allocator with mimalloc to avoid memory leaks.
# See:
# - https://github.com/Pato05/just_audio_media_kit#use-mimalloc-from-media-kits-readme
# - https://github.com/media-kit/media-kit#utilize-mimalloc
target_link_libraries(${BINARY_NAME} PRIVATE ${MIMALLOC_LIB})
# === Installation ===
# By default, "installing" just makes a relocatable bundle in the build