universal_html icon indicating copy to clipboard operation
universal_html copied to clipboard

videoElement.currentTime error

Open Megatronicus opened this issue 2 years ago • 38 comments

I'm getting an error for videoElement.currentTime = thumbnailTimeMs / 1000;

this is the error

lib/Screens/data/screen2.dart:6921:20: Error: The setter 'currentTime' isn't defined for the class 'VideoElement'.

  • 'VideoElement' is from 'package:universal_html/src/html.dart' ('/C:/Users/User/AppData/Local/Pub/Cache/hosted/pub.dev/universal_html-2.2.4/lib/src/html.dart'). Try correcting the name to the name of an existing setter, or defining a setter or field named 'currentTime'. videoElement.currentTime = thumbnailTimeMs / 1000;

This happened after the update to version universal_html: ^2.2.4

Latest version where everything worked universal_html: ^2.2.3

Megatronicus avatar Sep 18 '23 19:09 Megatronicus

Downgraded to 2.2.3, still shows the same error, might be something else that changed not the library, solved it with using different code anyway.

Megatronicus avatar Sep 20 '23 02:09 Megatronicus

So basically

This doesn't give error in android compile but gives error in web compile for flutter

 videoElement.setAttribute('currentTime', (thumbnailTimeMs / 1000).toString());
        final html.CanvasElement canvas = html.CanvasElement(
       width: videoElement.width,
         height: videoElement.height,
       );

This doesn't give error in web compile but gives error in android compile for flutter

  videoElement.currentTime = thumbnailTimeMs / 1000.0;
 final html.CanvasElement canvas = html.CanvasElement(
    width: videoElement.videoWidth,
    height: videoElement.videoHeight,
  );

I would have to comment out these parts when compiling for either, or possible solution move the whole method to a separate dart file make a new class and call the method like that after checking kIsWeb? Would that be an option for now? As it is now I can't have this code in the same dart file for web and android as it won't compile correctly. Any help is appreciated, thanks.

Megatronicus avatar Oct 22 '23 17:10 Megatronicus

I have tried putting the method in a separate class and making a kIsWeb check before calling that class so that maybe when I'm compiling for android/ios it doesn't check that class but it still checks it and I'm still getting the errors when trying to deploy with this specific code to android in flutter (Android Studio)

Code

        videoElement.currentTime = thumbnailTimeMs / 1000.0;
       final html.CanvasElement canvas = html.CanvasElement(
          width: videoElement.videoWidth,
          height: videoElement.videoHeight,
        );

Errors

page.dart:6598:22: Error: The setter 'currentTime' isn't defined for the class 'VideoElement'.
 - 'VideoElement' is from 'package:universal_html/src/html.dart' ('/C:/Users/User/AppData/Local/Pub/Cache/hosted/pub.dev/universal_html-2.2.4/lib/src/html.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named 'currentTime'.
        videoElement.currentTime = thumbnailTimeMs / 1000.0;
                     ^^^^^^^^^^^
page.dart:6605:31: Error: The getter 'videoWidth' isn't defined for the class 'VideoElement'.
 - 'VideoElement' is from 'package:universal_html/src/html.dart' ('/C:/Users/User/AppData/Local/Pub/Cache/hosted/pub.dev/universal_html-2.2.4/lib/src/html.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'videoWidth'.
          width: videoElement.videoWidth,
                              ^^^^^^^^^^
page.dart:6606:32: Error: The getter 'videoHeight' isn't defined for the class 'VideoElement'.
 - 'VideoElement' is from 'package:universal_html/src/html.dart' ('/C:/Users/User/AppData/Local/Pub/Cache/hosted/pub.dev/universal_html-2.2.4/lib/src/html.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'videoHeight'.
          height: videoElement.videoHeight,
                               ^^^^^^^^^^^

Can you please correct this, or should I download the universal_html, import all the classes instead of using pubspec and then change things on my own?

Megatronicus avatar Oct 23 '23 14:10 Megatronicus

Any help would be appreciated

Megatronicus avatar Oct 25 '23 20:10 Megatronicus

Hello? Any help would be appreciated.

Megatronicus avatar Oct 26 '23 21:10 Megatronicus

Hello? Any help would be appreciated with this.

Megatronicus avatar Nov 01 '23 20:11 Megatronicus

It's almost going to be 2 months since I asked a question here, can someone please respond?

Megatronicus avatar Nov 01 '23 21:11 Megatronicus

Please can you help me?

Megatronicus avatar Nov 02 '23 16:11 Megatronicus

Guys, please can someone here help me with this?

Megatronicus avatar Nov 05 '23 17:11 Megatronicus

Can someone please help me with this?

Megatronicus avatar Nov 06 '23 21:11 Megatronicus

Please guys, anyone?

Megatronicus avatar Nov 08 '23 02:11 Megatronicus

Please can someone please help me with this?

Megatronicus avatar Nov 08 '23 18:11 Megatronicus

Hello, guys, can someone please help me with this?!

Megatronicus avatar Nov 12 '23 00:11 Megatronicus

Any help would really be appreciated, can you please answer and help me with this?

Megatronicus avatar Nov 15 '23 23:11 Megatronicus

Hello, guys, any help would be appreciated

Megatronicus avatar Nov 19 '23 14:11 Megatronicus

Hi guys, once again, please help

Megatronicus avatar Nov 20 '23 11:11 Megatronicus

Guys I have been waiting since Sept 18, two months and 4 days for a response. Can you guys please help me?

Megatronicus avatar Nov 22 '23 12:11 Megatronicus

Please can you please answer guys?

Megatronicus avatar Nov 27 '23 17:11 Megatronicus

Guys, seriously, it's been like 2 and a half months by now, can you please answer?!??!?!?!!

Megatronicus avatar Nov 29 '23 09:11 Megatronicus

Please can you please respond?

Megatronicus avatar Nov 30 '23 10:11 Megatronicus

Can you please respond?

Megatronicus avatar Dec 02 '23 12:12 Megatronicus

Can I please get an answer. I've copied all the classes and pubspec into my app, need to modify it, maybe it will work like that. Removed universal_html from pubspec of the app. Next step reference all the classes internally, maybe this will cause more problems than I already have

Megatronicus avatar Dec 02 '23 18:12 Megatronicus

Please, can you answer

Megatronicus avatar Dec 03 '23 17:12 Megatronicus

Since it's not a library I can't access "import 'dart:indexed_db';" I've tried it all kinds of ways, also copying over 100 classes to my app just to change 2 lines of code so I can use universal_html is just overkill. Can you guys please answer, it should be a half a minute of work for you to change the code so it works correctly. Please answer.

Megatronicus avatar Dec 03 '23 19:12 Megatronicus

Can you guys please answer?

Megatronicus avatar Dec 05 '23 17:12 Megatronicus

Please, can you answer?

Megatronicus avatar Dec 07 '23 17:12 Megatronicus

Please guys come on can you please answer and solve this?

Megatronicus avatar Dec 07 '23 18:12 Megatronicus

I really need help with this, come on guys

Megatronicus avatar Dec 07 '23 18:12 Megatronicus

Is there a way to solve this quickly, please?

Megatronicus avatar Dec 07 '23 18:12 Megatronicus

There's gotta be a way from your side to just update that piece of the code. There's over a 100 classes in universal_html, it doesn't make a lot of sense copying all of that, I already tried it anyway but can't import indexed_db because the project is not a library and there were other errors connected probably to that.

Megatronicus avatar Dec 07 '23 18:12 Megatronicus