cedteg / flutter_fb_news

Flutter plugin for displaying Facebook page feed with photos and videos
https://pub.dev/packages/flutter_fb_news
MIT License
5 stars 3 forks source link

Videos are not loading on API Level 30 #23

Open VladRoscaDev opened 3 years ago

VladRoscaDev commented 3 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Import package
  2. fields:[FbNewsFields.header, FbNewsFields.attachmentsPhotos, FbNewsFields.attachmentsShare, FbNewsFields.attachmentsVideos, FbNewsFields.attachmentsVideoDirectResponseAutoplay, FbNewsFields.message, FbNewsFields.footer,]
  3. Run app

Expected behavior When i run the app I want to see the videos too.

Screenshots

Smartphone (please complete the following information):

Additional context The error that I get is the following: E/flutter ( 6441): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: 'package:flutter/src/services/message_codec.dart': Failed assertion: line 111 pos 15: 'code != null': is not true. E/flutter ( 6441): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39) E/flutter ( 6441): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5) E/flutter ( 6441): #2 new PlatformException package:flutter/…/services/message_codec.dart:111 E/flutter ( 6441): #3 VideoPlayerApi.create package:video_player_platform_interface/messages.dart:205 E/flutter ( 6441): <asynchronous suspension> E/flutter ( 6441): #4 MethodChannelVideoPlayer.create package:video_player_platform_interface/method_channel_video_player.dart:46 E/flutter ( 6441): <asynchronous suspension> E/flutter ( 6441): #5 VideoPlayerController.initialize package:video_player/video_player.dart:282 E/flutter ( 6441): <asynchronous suspension> E/flutter ( 6441): #6 _FbNewsAttachmentsVideoState.initPlayer package:flutter_fb_news/fb_news_attachments_video.dart:34 I am using the 1.1.3 version because I haven't migrated yet to null-safety Am I doing something wrong?

cedteg commented 3 years ago

Thank you for submitting this Issue.

Does the problem with the example provided in the package also occur with their access?

In my test with the 2.0.0 and the 1.1.3 I can not reproduce this Issue.

VladRoscaDev commented 3 years ago

config: FbNewsConfig( backgroundColor: Colors.white, subtitle: 'from Facebook', waiting: Column( children: [ CircularProgressIndicator(), SizedBox(height: 10), ], ), noDataOrError: Card( color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15)), elevation: 5, child: Container( width: context.width * 0.8, height: context.height * 0.2, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ SizedBox( width: context.width * 0.02, ), Icon( Icons.warning, color: Colors.orange, size: 50, ), SizedBox( width: context.width * 0.02, ), Flexible( child: Text( 'There seems to be an issue with the facebook feed. Please come back later and try again', style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold), ), ) ], ), ), ), fields: [ FbNewsFields.header, FbNewsFields.attachmentsPhotos, FbNewsFields.attachmentsShare, FbNewsFields.attachmentsVideos, FbNewsFields.attachmentsVideoDirectResponseAutoplay, FbNewsFields.message, FbNewsFields.footer, ],

This is how I wrote the code according to your example. How do I align the code so it can be more understandable?

I think this is the same issue: https://stackoverflow.com/questions/64191623/the-video-player-plugin-fails-to-play-videos-flutter

VladRoscaDev commented 3 years ago

Any updates on this?

VladRoscaDev commented 3 years ago

i have update the version to version 2.0.0 and i still get the following error on both physical device and on emulator:

E/flutter (  479): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(NullPointerException, java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.endsWith(java.lang.String)' on a null object reference, null, null)
E/flutter (  479): #0      VideoPlayerApi.create
package:video_player_platform_interface/messages.dart:189
E/flutter (  479): <asynchronous suspension>
E/flutter (  479): #1      MethodChannelVideoPlayer.create
package:video_player_platform_interface/method_channel_video_player.dart:47
E/flutter (  479): <asynchronous suspension>
E/flutter (  479): #2      VideoPlayerController.initialize
package:video_player/video_player.dart:308
E/flutter (  479): <asynchronous suspension>
VladRoscaDev commented 3 years ago

Do you need any more info or any help on this?

cedteg commented 3 years ago

@VladRoscaDev sorry for the late response.

I have updated the dependencies. Could you check if the problem still occurs?

You can include the version as follows

flutter_fb_news:
    git:
      url: https://github.com/cedteg/flutter_fb_news.git
VladRoscaDev commented 3 years ago

I will test this out, also I noticed something, but maybe this is how it is intended. I don't get access to all the feed, it loads up 25 posts, no matter the limit that I set.

Is this how it is supposed to be or do i have to specify something else. I have set the limit to 50 posts

cedteg commented 3 years ago

I created a Issue for the bug https://github.com/cedteg/flutter_fb_news/issues/24

stan055 commented 3 years ago

I will test this out, also I noticed something, but maybe this is how it is intended. I don't get access to all the feed, it loads up 25 posts, no matter the limit that I set.

Is this how it is supposed to be or do i have to specify something else. I have set the limit to 50 posts

You need to change the class FbNewsService like this InkedFbNewsService_LI

stan055 commented 3 years ago

The video doesn't work, facebook doesn't send me the "source" url, just the regular url. Does anyone know why? help

cedteg commented 3 years ago

I will test this out, also I noticed something, but maybe this is how it is intended. I don't get access to all the feed, it loads up 25 posts, no matter the limit that I set. Is this how it is supposed to be or do i have to specify something else. I have set the limit to 50 posts

You need to change the class FbNewsService like this InkedFbNewsService_LI

Thank you for the hint

cedteg commented 3 years ago

The video doesn't work, facebook doesn't send me the "source" url, just the regular url. Does anyone know why? help

Strange,

but it looks like the video is not publicly available and the API token has no access to the video

VladRoscaDev commented 3 years ago

Any updates on this?

VladRoscaDev commented 3 years ago

I kept testing and this is the error that I am getting:

[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(NullPointerException, java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.endsWith(java.lang.String)' on a null object reference, null, null)
E/flutter (20858): #0      VideoPlayerApi.create
package:video_player_platform_interface/messages.dart:189
E/flutter (20858): <asynchronous suspension>
E/flutter (20858): #1      MethodChannelVideoPlayer.create
package:video_player_platform_interface/method_channel_video_player.dart:47
E/flutter (20858): <asynchronous suspension>
E/flutter (20858): #2      VideoPlayerController.initialize
package:video_player/video_player.dart:308
E/flutter (20858): <asynchronous suspension>
E/flutter (20858): #3      _FbNewsAttachmentsVideoState.initPlayer
package:flutter_fb_news/fb_news_attachments_video.dart:34
E/flutter (20858): <asynchronous suspension>
E/flutter (20858):

Is it possible that facebook doesn't share videos, or does facebook id required some specific config for sharing videos?

VladRoscaDev commented 3 years ago

Any updates on this?