flutter_packages icon indicating copy to clipboard operation
flutter_packages copied to clipboard

[ BUG ] : A clear and concise title of the bug

Open Bus42 opened this issue 1 year ago • 1 comments

Plugin name

appinio_video_player

Describe the bug

../storyflix/lib/src/widgets/movie_player.dart:18:8: Error: Type 'CachedVideoPlayerController' not found.
  late CachedVideoPlayerController _videoPlayerController;
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
../storyflix/lib/src/widgets/movie_player.dart:18:8: Error: 'CachedVideoPlayerController' isn't a type.
  late CachedVideoPlayerController _videoPlayerController;
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
../storyflix/lib/src/widgets/movie_player.dart:24:9: Error: The getter 'CachedVideoPlayerController' isn't defined for the class '_MoviePlayerState'.
 - '_MoviePlayerState' is from 'package:storyflix/src/widgets/movie_player.dart' ('../storyflix/lib/src/widgets/movie_player.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'CachedVideoPlayerController'.
        CachedVideoPlayerController.network(widget.videoUrl.toString());
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^

To Reproduce

Steps to reproduce the behavior:

  1. Set up player as per example code in pub.dev
  2. Run the app
  3. Get the error

Expected behavior

the CachedVideoPlayerController class exported by the appinio_video_player package should be available to the consuming app.

Screenshots

N/A - it would only be a picture of the error above

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome 124.0.6367.119
  • Version 22H3

Smartphone (please complete the following information):

  • Device: Pixel 7 Pro
  • OS: Android
  • Browser: stock
  • Version 14

Additional context

This is my implementation:

import 'package:appinio_video_player/appinio_video_player.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

class MoviePlayer extends StatefulWidget {
  final Uri videoUrl;
  final String title;

  const MoviePlayer({super.key, required this.videoUrl, required this.title});

  @override
  State<MoviePlayer> createState() => _MoviePlayerState();
}

class _MoviePlayerState extends State<MoviePlayer> {
  late CustomVideoPlayerWebController _customVideoPlayerWebController;
  late CustomVideoPlayerController _customVideoPlayerController;
  late CachedVideoPlayerController _videoPlayerController;

  @override
  void initState() {
    super.initState();
    _videoPlayerController =
        CachedVideoPlayerController.network(widget.videoUrl.toString());
    if (kIsWeb) {
      _customVideoPlayerWebController = CustomVideoPlayerWebController(
          webVideoPlayerSettings: CustomVideoPlayerWebSettings(
        src: widget.videoUrl.toString(),
      ));
    } else {
      _customVideoPlayerController = CustomVideoPlayerController(
          context: context, videoPlayerController: _videoPlayerController);
    }
  }

  @override
  void dispose() {
  super.dispose();
    _customVideoPlayerController.dispose();
    _videoPlayerController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    Widget videoPlayer = kIsWeb
        ? CustomVideoPlayerWeb(
            customVideoPlayerWebController: _customVideoPlayerWebController,
          )
        : CustomVideoPlayer(
            customVideoPlayerController: _customVideoPlayerController);

    return Center(
      child: videoPlayer,
    );
  }
}

I don't have any additional relevant information, but I would gladly provide any information needed to fix this.

Bus42 avatar May 09 '24 03:05 Bus42

So, I did a little digging and the issue lies with the cached_video_player package. It needs to be updated to be compatible with AGP 8

Incorrect package="com.lazyarts.vikram.cached_video_player" found in source AndroidManifest.xml: C:\Users\gbrew\AppData\Local\Pub\Cache\hosted\pub.dev\cached_video_player-2.0.4\android\src\main\AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.lazyarts.vikram.cached_video_player" from the source AndroidManifest.xml: C:\Users\gbrew\AppData\Local\Pub\Cache\hosted\pub.dev\cached_video_player-2.0.4\android\src\main\AndroidManifest.xml.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cached_video_player:processDebugManifest'.
> A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
   > Incorrect package="com.lazyarts.vikram.cached_video_player" found in source AndroidManifest.xml: C:\Users\gbrew\AppData\Local\Pub\Cache\hosted\pub.dev\cached_video_player-2.0.4\android\src\main\AndroidManifest.xml.
     Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
     Recommendation: remove package="com.lazyarts.vikram.cached_video_player" from the source AndroidManifest.xml: C:\Users\gbrew\AppData\Local\Pub\Cache\hosted\pub.dev\cached_video_player-2.0.4\android\src\main\AndroidManifest.xml.

Bus42 avatar May 09 '24 18:05 Bus42