ardera / flutter_packages

My collected packages for pub.dev
MIT License
28 stars 7 forks source link

Exception error PlatformException(illegalargument, Expected `arg['playerId']` to be a valid player id., null, null) #7

Open CodyPChristian opened 2 years ago

CodyPChristian commented 2 years ago

Hey, trying to get this working on a RP4 using your omxplayer_video_player code and the sample app. I first made sure I followed the instructions here: https://github.com/ardera/flutter-pi and got that fully working. I then modified the flutter_gallery project to load a video player so I can test performance. I first used the normal video_player package and tested that, nothing played but also no errors. I then installed your package and now I get errors in the output. GUI wisd everything loads, white area where player should be, I hit play and nothing. I exit the app and check console and see the errors.

I'm on a RP 4b using bullseye.

video_player 2.2.16 and I also tried 2.0.0

I included a photo below of the output, I also tried to OCR the image for you to get the output in text form.

U: PortSettingsChanged: 1280x720029,97 Interlace:0 deinterlace:0 anaglyph:© par:nan display:© layer:-128 alpha:255 aspecthode:0
[compositor] GPU does not supported the desired Hi plane order.
Sone UI layers may be invisible.
(flutter-pI1 Error handing platform message. plugin_registry_on_platform nessage: Invalid argument
(flutter-pli Error handling platform nessave. plugin registry on _platforn nessage: Invalld argument
[BRRO:Plutter/11b/u1/u1_dart_state.cc(209)]Unhandled Exception? PletfornException (illegalargunent, Expected 'argl'playerld'J° to be a valid player id., null, null?
80
StandardMethodCodee.decodeknuelope(package:flutter/src/services/message_codecs.dart.:607:7)
81
MethodChannel._InvokeMethod (package: flutter/src/serulces/platform_channel.dart:167:18)
asynchronous suspension>
$2
VldeoPlayerController._applyLooping(package:video_player/uldeo_player.dart:465:5)
asynchronous suspension›
null.
null)
MethodChannel.-_Invoketlethod(packagetflutter/sre/serulces/platforn_channel.dart:167:18)
asynchronous suspension›
182
VideoPlayerController._applyVolume(package:uldeo_player/uldeo_player.dart:505:5)
asynchronous suspension›
asynchronous suspension›
3 82
VldeoPlayerController._applyPlayPause(package:vldeo_player/uldeo_player.dart:497:7)
asynchronous suspension>
1 [flutter-pi1 Error handling platform message. pluginregistry_on_platfornnessage: Invalid argunent
MethodChanne1 ._invokeMethod (package: flutter/src/services/platform_channel .dart: 167:16)
asynchronous suspension>
$2
_OmxPlayerVleuController._initialize (package:onxplayer_uldeo_player/src/onxplayer_view.dart:51:5)
‹asynchronous suspension›
R Seek to: 00:00:00
[flutter-pil Error handling platform nessage, plugin registry on platforn_message: Invalld argument
(ERROR: flutter/11b/ul/ul_dart_state.cc(209)] Unhandled Exception: PlatfornException(Illegalargument. Expected 'argi'playerid°J° to be a valid player 1d.. mull.
80
StandardMethodCodec.decodeEnvelope(package:flutter/src/seruices/message_codecs.dart:607:7)
$1
MethodChannel._InvokeMethod(package:flutter/src/serulces/platform_channel.dart:167:18)
(asynchronous suspension>
82
VldeoPlayerController._opplyPlayPause(package:video_player/video_player.dart:473:7)
asynchronous suspension›
$3
VideoPlayerController.play(package:uldeo_player/uldeo_player.dart:445:5)
(asynchronous suspension>

image

Here is the modified main.dart file from the flutter_gallery project (same commit as your readme)

// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';
import 'package:flutter_localized_locales/flutter_localized_locales.dart';
import 'package:gallery/constants.dart';
import 'package:gallery/data/gallery_options.dart';
import 'package:gallery/pages/backdrop.dart';
import 'package:gallery/pages/splash.dart';
import 'package:gallery/routes.dart';
import 'package:gallery/themes/gallery_theme_data.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:omxplayer_video_player/omxplayer_video_player.dart';
import 'package:video_player/video_player.dart';
export 'package:gallery/data/demos.dart' show pumpDeferredLibraries;

void main() {
  GoogleFonts.config.allowRuntimeFetching = false;
  if (OmxplayerVideoPlayer.isPlatformSidePresent()) {
    OmxplayerVideoPlayer.useAsImplementation();
  }
  runApp(const VideoApp());
}

class VideoApp extends StatefulWidget {
  @override
  _VideoAppState createState() => _VideoAppState();
  const VideoApp({Key key}) : super(key: key);
}

class _VideoAppState extends State<VideoApp> {
  VideoPlayerController _controller;
  Future<void> _initializeVideoPlayerFuture;

  @override
  void initState() {
    super.initState();
    // _controller = VideoPlayerController.network('https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4');
    _controller = VideoPlayerController.asset('assets/test.mp4');

    // _controller.addListener(() {
    //   setState(() {});
    // });
    // _controller.setLooping(true);
    _initializeVideoPlayerFuture = _controller.initialize();
    // _controller.play();

    // super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Video Demo',
      home: Scaffold(
        // body: Center(
        //   // child: _controller.value.isInitialized
        //   //     ? AspectRatio(
        //   //         aspectRatio: _controller.value.aspectRatio,
        //   //         child: VideoPlayer(_controller),
        //   //       )
        //   //     : Container(),
        //   child: AspectRatio(
        //     aspectRatio: _controller.value.aspectRatio,
        //     child: Stack(
        //       alignment: Alignment.bottomCenter,
        //       children: <Widget>[
        //         VideoPlayer(_controller),
        //         VideoProgressIndicator(_controller, allowScrubbing: true),
        //       ],
        //     ),
        //   ),
        // ),
        // Use a FutureBuilder to display a loading spinner while waiting for the
        // VideoPlayerController to finish initializing.
        body: FutureBuilder(
          future: _initializeVideoPlayerFuture,
          builder: (context, snapshot) {
            if (snapshot.connectionState == ConnectionState.done) {
              // If the VideoPlayerController has finished initialization, use
              // the data it provides to limit the aspect ratio of the video.
              return AspectRatio(
                aspectRatio: _controller.value.aspectRatio,
                // Use the VideoPlayer widget to display the video.
                child: VideoPlayer(_controller),
                // child: Stack(
                //   alignment: Alignment.bottomCenter,
                //   children: <Widget>[
                //     VideoPlayer(_controller),
                //     VideoProgressIndicator(_controller, allowScrubbing: true),
                //   ],
                // ),
              );
            } else {
              // If the VideoPlayerController is still initializing, show a
              // loading spinner.
              return const Center(child: CircularProgressIndicator());
            }
          },
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            setState(() {
              _controller.value.isPlaying
                  ? _controller.pause()
                  : _controller.play();
            });
          },
          child: Icon(
            _controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
          ),
        ),
      ),
    );
  }

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

/*class GalleryApp extends StatelessWidget {
  const GalleryApp({
    Key key,
    this.initialRoute,
    this.isTestMode = false,
  }) : super(key: key);

  final bool isTestMode;
  final String initialRoute;

  @override
  Widget build(BuildContext context) {
    return ModelBinding(
      initialModel: GalleryOptions(
        themeMode: ThemeMode.system,
        textScaleFactor: systemTextScaleFactorOption,
        customTextDirection: CustomTextDirection.localeBased,
        locale: null,
        timeDilation: timeDilation,
        platform: defaultTargetPlatform,
        isTestMode: isTestMode,
      ),
      child: Builder(
        builder: (context) {
          return MaterialApp(
            // By default on desktop, scrollbars are applied by the
            // ScrollBehavior. This overrides that. All vertical scrollables in
            // the gallery need to be audited before enabling this feature,
            // see https://github.com/flutter/gallery/issues/523
            scrollBehavior:
                const MaterialScrollBehavior().copyWith(scrollbars: false),
            restorationScopeId: 'rootGallery',
            title: 'Flutter Gallery',
            debugShowCheckedModeBanner: false,
            themeMode: GalleryOptions.of(context).themeMode,
            theme: GalleryThemeData.lightThemeData.copyWith(
              platform: GalleryOptions.of(context).platform,
            ),
            darkTheme: GalleryThemeData.darkThemeData.copyWith(
              platform: GalleryOptions.of(context).platform,
            ),
            localizationsDelegates: const [
              ...GalleryLocalizations.localizationsDelegates,
              LocaleNamesLocalizationsDelegate()
            ],
            initialRoute: initialRoute,
            supportedLocales: GalleryLocalizations.supportedLocales,
            locale: GalleryOptions.of(context).locale,
            localeListResolutionCallback: (locales, supportedLocales) {
              deviceLocale = locales.first;
              return basicLocaleListResolution(locales, supportedLocales);
            },
            onGenerateRoute: RouteConfiguration.onGenerateRoute,
          );
        },
      ),
    );
  }
}

class RootPage extends StatelessWidget {
  const RootPage({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const ApplyTextOptions(
      child: SplashPage(
        child: Backdrop(),
      ),
    );
  }
}*/
ardera commented 2 years ago

Are you using 64-bit? I'm a bit surprised how you got omxplayer running on bullseye, thought that was unsupported there.

If you're using bullseye, you might have more luck by using the in development gstreamer video player in the feature/gstreamer-video-player branch.

For that, you don't need to install any pub packages. Just specify -DBUILD_GSTREAMER_VIDEO_PLAYER_PLUGIN=On -DBUILD_OMXPLAYER_VIDEO_PLAYER_PLUGIN=Off when configuring flutter-pi and install some gstreamer packages:

$ sudo apt install libgstreamer1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-g
ood gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-plugins-base-apps