Flutter app is crash when adding YoutubePlayer in some cases - flutter

I used youtube_player_flutter to load youtube video.But in some cases app is crash when i open the screen containing youtube video .Some time it working perfectly.
I got the below exception,
[ERROR:flutter/fml/platform/android/jni_util.cc(204)] java.lang.IllegalStateException: Platform view hasn't been initialized from the platform view channel.
Code to load youtube video ,
YoutubePlayer(
controller: YoutubePlayerController(
initialVideoId: YoutubePlayer.convertUrlToId(
controller.reelsList[index].url.toString())
.toString(),
flags: const YoutubePlayerFlags(
autoPlay: false,
mute: false,
hideControls: false,
showLiveFullscreenButton: false),
),
showVideoProgressIndicator: true,
)
compileSdkVersion 33
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion

i got the same trouble some weeks ago when i was implementing the same feature.
First, run on your terminal:
flutter clean
then
flutter pub get
then build your application again
This did the work for me,
By the way, i got some trouble with useHybridComposition making my app laggy on my physic device, so i've set it to false.
I've implemented this way, but i don't really think your code have any mistakes at all;
YoutubePlayer(
controller: YoutubePlayerController(
initialVideoId: videoModel.url,
flags: const YoutubePlayerFlags(
useHybridComposition: false,
mute: false,
autoPlay: false,
disableDragSeek: true,
loop: false,
isLive: false,
forceHD: false,
enableCaption: false,
showLiveFullscreenButton:
false),
),
showVideoProgressIndicator: true,
progressIndicatorColor:
colorScheme.secondary,
progressColors: progressColors,
),
Update me, we can discuss further if this doesn't work for you.

Related

flutter inappwebview : "window.flutter_inappwebview.callHandler" dosn't work in ios

javascript call “ window.flutter_inappwebview.callHandler('handlerFoo') ”
version: ^5.7.2+2
android is ok,but can't use in ios;
In addition, it is found that consoleMessage is invalid under ios.
my options:
options = InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
useShouldOverrideUrlLoading: true,
useShouldInterceptFetchRequest: true,
),
android: AndroidInAppWebViewOptions(
useHybridComposition: true,
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
),
);
enter image description here
enter image description here
by the way ,There is a very old project in which he uses webview interaction within ios:
"window.webkit.messageHandlers.openScan.postMessage({})"
How to intercept the request "window.webkit.messageHandlers.openScan.postMessage ({})" without modifying the original web page project?
Thank you very much for your help
Can you run it for me?

Flutter - Jitsi Meet I want to add new options or at least modify an option

I'm trying to add new option like invite more people not by link but with a call notification.
anyone solved this issue ?? please help.
you can use feature flages like below
Map<FeatureFlag, Object> featureFlags = {
FeatureFlag.isMeetingNameEnabled: false,
FeatureFlag.isServerUrlChangeEnabled: true,
FeatureFlag.isChatEnabled: false,
FeatureFlag.isAddPeopleEnabled: false,
FeatureFlag.areSecurityOptionsEnabled: false,
FeatureFlag.isCalendarEnabled: false,
FeatureFlag.isCloseCaptionsEnabled: false,
FeatureFlag.isFilmstripEnabled: false,
FeatureFlag.isHelpButtonEnabled: false,
FeatureFlag.isInviteEnabled: false,
FeatureFlag.isLiveStreamingEnabled: false,
FeatureFlag.isLobbyModeEnabled: false,
FeatureFlag.isOverflowMenuEnabled: false,
FeatureFlag.isReactionsEnabled: false,
FeatureFlag.isRaiseHandEnabled: false,
FeatureFlag.isRecordingEnabled: false,
FeatureFlag.isReplaceParticipantEnabled: false,
};
var options = JitsiMeetingOptions(
isVideoMuted: true,
roomNameOrUrl: name,
userDisplayName: prefs.getString('username')!,
serverUrl: 'https://**********',
featureFlags: featureFlags,
);

Is there a way to get a warning about Array.from() when using "esversion": 5 and "futurehostile": true?

Got bitten by an IE bug (yeah, we're still using the old WebBrowser control) that I thought the dbaeumer.jshint extension would help me prevent...
Is there a way to get warning when using ES6 features, such as Array.from() in Visual Studio Code?
My global settings.json file contains this:
"jshint.reportWarningsAsErrors": true,
"jshint.lintHTML": true,
"jshint.options":{
"unused": true,
"esversion": 5,
"futurehostile": true,
"jquery": true,
"browser": true,
"eqeqeq": true,
"curly": true,
"strict": "global",
"devel": true,
"-W097": true,
},
I thought "esversion": 5 would do the job, or even "futurehostile": true, but no such luck.
jshint has no issue with this line:
return Array.from(el.childNodes).slice(-1)[0].data;
(The tooltip shown for from is just any, which is suspicious, but there is nothing in the Problems panel.

Visual Studio Code Flutter Format is Not Working with My Indent Space Value

I wasted my all day and i didnt understand what is going on. I'm using Visual Studio Code 1.40.2 and i am learning Flutter 3.60. Sometimes Flutter codes turn unreadable because of indent space. I only wanted to create more space (indent space) but when i use format option, tab size is turning again 2. I looked too many web sites including Stackoverflow and unfortunately i didnt find solution.It turned annoying. This is my config file: (Thanks for help)
{
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"editor.fontSize": 18,
"editor.fontFamily": "Consolas, 'Courier New', monospace, ",
"dart.openDevTools": "flutter",
"workbench.colorTheme": "Night Owl (No Italics)",
"workbench.iconTheme": "material-icon-theme",
"editor.fastScrollSensitivity": 8,
"editor.tabSize": 8,
"editor.insertSpaces": true,
"editor.wordWrap": "on",
"editor.smoothScrolling": true,
"editor.cursorBlinking": "expand",
"editor.cursorSmoothCaretAnimation": true,
"editor.fontWeight": "400",
"outline.showFields": false,
"[dart]": {
"editor.tabSize": 6,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
},
}
I changed editor.insertSpaces false and true and nothing changed.
editor.detectIndentation true or false is not working.
I added this block but didnt worked.
"[flutter]": {
"editor.tabSize": 6,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
},
This is my simple code:
import 'package:flutter/material.dart';
class GridListe extends StatelessWidget {
#override
Widget build(BuildContext context) {
return GridView.count(
crossAxisCount: 3,
primary: false,
padding: EdgeInsets.all(10),
crossAxisSpacing: 20,
mainAxisSpacing: 40,
children: <Widget>[
Container(
alignment: Alignment.center,
color: Colors.teal,
child: Text(
"Salam",
textAlign: TextAlign.center,
),
),
],
);
}
}
When i use format code (Shift + alt + p) Codes indent space or tab size turn 2 and it will make me crazy.
import 'package:flutter/material.dart';
class GridListe extends StatelessWidget {
#override
Widget build(BuildContext context) {
return GridView.count(
crossAxisCount: 3,
primary: false,
padding: EdgeInsets.all(10),
crossAxisSpacing: 20,
mainAxisSpacing: 40,
children: <Widget>[
Container(
alignment: Alignment.center,
color: Colors.teal,
child: Text(
"Salam",
textAlign: TextAlign.center,
),
),
],
);
}
}
Add your this in your settings.json file
"[dart]": {
"editor.defaultFormatter": "Dart-Code.dart-code",
"editor.formatOnSave": true
},
Just add the below code in your ProjectDir/ProjectName/.vscode/settings.json
{
"editor.defaultFormatter": "Dart-Code.dart-code",
"editor.formatOnSave": true
}
Edit a file name settings.json inside .vscode folder
note: {if not available create like this}
then paste this json
{
"[dart]": {
"editor.defaultFormatter": "Dart-Code.dart-code",
"editor.formatOnSave": true
},
}
follow these instruction ->
The Dart extension for VS Code uses the formatter from the Dart SDK (dart_style) which does not support customising the indent options (by design) so it will always use 2-spaces.
It is possible to disable the built-in formatter should you wish to format manually, and it's also possible for other VS Code extensions to contribute formatters for Dart - though as far as I am aware none have (yet) been created (though I have offered assistance in this issue should someone be interested in creating a VS Code extension to do this).
Open Settings (json)
Find [dart] and add "editor.tabSize": 4
If your FormatOnSave doesn't work you can check if there is one more existing keybindings set to the same key as the File:save in your VS Code, because that could also stop your FormatOnSave to work. Hope it helps!

Decoding the *.gwt.rpc file generated as per GWT's serialization policy

I'm trying to do a bit of background reading on GWT RPC serialization policy and found that GWT whitelists the serializable types in a *.gwt.rpc file post compilation.
The following is an excerpt of one such .gwt.rpc file generated in my application:
com.subex.rocforms.sample.client.gwt.demo.PriorityModel, true, true, true, true, com.subex.rocforms.sample.client.gwt.demo.PriorityModel/3885356691, 3885356691
com.subex.rocforms.sample.client.gwt.demo.TeamModel, true, true, true, true, com.subex.rocforms.sample.client.gwt.demo.TeamModel/3447853257, 3447853257
com.subex.rocforms.sample.client.gwt.demo.dayGroup.DayGroupDateModel, true, true, true, true, com.subex.rocforms.sample.client.gwt.demo.dayGroup.DayGroupDateModel/2876933254, 2876933254
[Lcom.subex.rocforms.sample.client.gwt.demo.dayGroup.DayGroupDateModel;, true, true, true, true, [Lcom.subex.rocforms.sample.client.gwt.demo.dayGroup.DayGroupDateModel;/2086898801, 2086898801
com.subex.rocforms.sample.client.gwt.demo.dayGroup.DayGroupMemberModel, true, true, true, true, com.subex.rocforms.sample.client.gwt.demo.dayGroup.DayGroupMemberModel/471099479, 471099479
[Lcom.subex.rocforms.sample.client.gwt.demo.dayGroup.DayGroupMemberModel;, true, true, true, true, [Lcom.subex.rocforms.sample.client.gwt.demo.dayGroup.DayGroupMemberModel;/2005061951, 2005061951
com.subex.rocforms.sample.client.gwt.demo.dayGroup.DayGroupModel, true, true, true, true, com.subex.rocforms.sample.client.gwt.demo.dayGroup.DayGroupModel/2207687264, 2207687264
com.subex.rocforms.sample.client.gwt.demo.dayGroup.TimeStringModel, true, true, true, true, com.subex.rocforms.sample.client.gwt.demo.dayGroup.TimeStringModel/335976723, 335976723
com.subex.rocforms.sample.client.gwt.demo.scheduleGrid.ComponentModel, true, true, true, true, com.subex.rocforms.sample.client.gwt.demo.scheduleGrid.ComponentModel/2493196280, 2493196280
[Lcom.subex.rocforms.sample.client.gwt.demo.scheduleGrid.ComponentModel;, true, true, true, true, [Lcom.subex.rocforms.sample.client.gwt.demo.scheduleGrid.ComponentModel;/3060182407, 3060182407
Can anybody explain what the four flags quoted after the type in each row indicate?
The best answer to that, other than poking into the code of course, is reading the Brian Slesinsky's reverse engineering notes about the GWT-RPC format. Have a look under the policy file format subsection and you'll find your answer.