abdelaziz-mahdy / flutter_meedu_videoplayer

Cross-Platform Video Player for flutter
https://abdelaziz-mahdy.github.io/flutter_meedu_videoplayer/
MIT License
132 stars 69 forks source link

Error: while building for IOS only #170

Closed evan8133 closed 10 months ago

evan8133 commented 10 months ago

I have added this package to my application and it works perfectly with android and web with online and file videos that supper great but when i wanted to try it with IOS it was working and at some point stoped working honestly I dont know what did i do this is what im getting:

Error Log:

Launching lib/main.dart on iPad Pro (11-inch) (4th generation) in debug mode...
main.dart:1
Xcode build done.                                           10.6s
Failed to build iOS app
Error (Xcode): Undefined symbol: _MDK_setLogHandler

Error (Xcode): Undefined symbol: _mdkPlayerAPI_delete

Error (Xcode): Undefined symbol: _mdkPlayerAPI_new

Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

Could not build the application for the simulator.
Error launching application on iPad Pro (11-inch) (4th generation).
Exited

this is one example of usage :

// ignore_for_file: public_member_api_docs, sort_constructors_first

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_meedu_videoplayer/meedu_player.dart';

class CustomVideoPlayerWidget extends StatefulWidget {
  final String videoUrl;

  const CustomVideoPlayerWidget({
    Key? key,
    required this.videoUrl,
  }) : super(key: key);

  @override
  // ignore: library_private_types_in_public_api
  _CustomVideoPlayerWidgetState createState() =>
      _CustomVideoPlayerWidgetState();
}

class _CustomVideoPlayerWidgetState extends State<CustomVideoPlayerWidget> {
  final _meeduPlayerController = MeeduPlayerController(
    loadingWidget: const Center(
      child: CircularProgressIndicator(),
    ),
    initialFit: BoxFit.contain,
    pipEnabled: true,
    manageBrightness: false,
    screenManager: const ScreenManager(
      forceLandScapeInFullscreen: true,
      hideSystemOverlay: true,
    ),
  );

  @override
  void initState() {
    super.initState();
    _meeduPlayerController.setDataSource(
      DataSource(
        type: DataSourceType.network,
        source: widget.videoUrl,
      ),
      autoplay: true,
    );
  }

  @override
  void dispose() {
    _meeduPlayerController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MeeduVideoPlayer(
      controller: _meeduPlayerController,
    );
  }
}

Version:

Flutter 3.13.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision efbf63d9c6 (6 days ago) • 2023-08-15 21:05:06 -0500
Engine • revision 1ac611c64e
Tools • Dart 3.1.0 • DevTools 2.25.0

Notes* I already added ' initMeeduPlayer(); ' to main Already added this in info.plist

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

Aslo the minimum IOS version is on 14

I will gladly provide more information if needed

abdelaziz-mahdy commented 10 months ago

I have added this package to my application and it works perfectly with android and web with online and file videos that supper great but when i wanted to try it with IOS it was working and at some point stoped working honestly I dont know what did i do this is what im getting:

Error Log:

Launching lib/main.dart on iPad Pro (11-inch) (4th generation) in debug mode...
main.dart:1
Xcode build done.                                           10.6s
Failed to build iOS app
Error (Xcode): Undefined symbol: _MDK_setLogHandler

Error (Xcode): Undefined symbol: _mdkPlayerAPI_delete

Error (Xcode): Undefined symbol: _mdkPlayerAPI_new

Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

Could not build the application for the simulator.
Error launching application on iPad Pro (11-inch) (4th generation).
Exited

this is one example of usage :

// ignore_for_file: public_member_api_docs, sort_constructors_first

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_meedu_videoplayer/meedu_player.dart';

class CustomVideoPlayerWidget extends StatefulWidget {
  final String videoUrl;

  const CustomVideoPlayerWidget({
    Key? key,
    required this.videoUrl,
  }) : super(key: key);

  @override
  // ignore: library_private_types_in_public_api
  _CustomVideoPlayerWidgetState createState() =>
      _CustomVideoPlayerWidgetState();
}

class _CustomVideoPlayerWidgetState extends State<CustomVideoPlayerWidget> {
  final _meeduPlayerController = MeeduPlayerController(
    loadingWidget: const Center(
      child: CircularProgressIndicator(),
    ),
    initialFit: BoxFit.contain,
    pipEnabled: true,
    manageBrightness: false,
    screenManager: const ScreenManager(
      forceLandScapeInFullscreen: true,
      hideSystemOverlay: true,
    ),
  );

  @override
  void initState() {
    super.initState();
    _meeduPlayerController.setDataSource(
      DataSource(
        type: DataSourceType.network,
        source: widget.videoUrl,
      ),
      autoplay: true,
    );
  }

  @override
  void dispose() {
    _meeduPlayerController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MeeduVideoPlayer(
      controller: _meeduPlayerController,
    );
  }
}

Version:

Flutter 3.13.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision efbf63d9c6 (6 days ago) • 2023-08-15 21:05:06 -0500
Engine • revision 1ac611c64e
Tools • Dart 3.1.0 • DevTools 2.25.0

Notes* I already added ' initMeeduPlayer(); ' to main Already added this in info.plist

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

Aslo the minimum IOS version is on 14

I will gladly provide more information if needed

were you using an older version?

i had to migrate from media_kit to fvp so if you were using a n older version that may be the cause

also can you try to compile the package example? since the github actions are working as expected i want to be sure if its a project problem or a main problem

evan8133 commented 10 months ago

I think the reason was the app was already running and i added this package with hot restart was fine and stated an ipad emulator to check the size and this happened, sorry when can i get the example so i can try and see what is the problem

evan8133 commented 10 months ago

now a very wired thing happened i got my physical device and run the application throw Xcode and it works fine i will try a couple of things see what is it my its my side, one small question is there a way to force the player from ltr to rtl or vice versa

abdelaziz-mahdy commented 10 months ago

now a very wired thing happened i got my physical device and run the application throw Xcode and it works fine i will try a couple of things see what is it my its my side, one small question is there a way to force the player from ltr to rtl or vice versa

i didnt try that before, maybe but for each part you can control that yes? not all of it at once

evan8133 commented 10 months ago

Good thank for helping i'm still trying to figure it out because my physical phone is on a beta version but i don't still i cant test it on Xcode for emulators will try to fix it for now i will close this

abdelaziz-mahdy commented 10 months ago

it was a problem from fvp on the simulator

fvp author comment I've updated mdk in cocoapods. Now you can run pod repo update to update local indices, then run pod cache clean mdk and in example/ios run pod deintegrate

to fix it