Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c0bbb4e

Browse files
video player bug fix
1 parent 74e2a33 commit c0bbb4e

File tree

12 files changed

+306
-13
lines changed

12 files changed

+306
-13
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Flutter",
9+
"request": "launch",
10+
"type": "dart"
11+
}
12+
]
13+
}

‎day_11_02_video_player/ios/Podfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
# platform :ios, '9.0'
2+
platform :ios, '9.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
PODS:
2+
- Flutter (1.0.0)
3+
- screen (0.0.1):
4+
- Flutter
5+
- video_player (0.0.1):
6+
- Flutter
7+
- video_player_web (0.0.1):
8+
- Flutter
9+
10+
DEPENDENCIES:
11+
- Flutter (from `Flutter`)
12+
- screen (from `.symlinks/plugins/screen/ios`)
13+
- video_player (from `.symlinks/plugins/video_player/ios`)
14+
- video_player_web (from `.symlinks/plugins/video_player_web/ios`)
15+
16+
EXTERNAL SOURCES:
17+
Flutter:
18+
:path: Flutter
19+
screen:
20+
:path: ".symlinks/plugins/screen/ios"
21+
video_player:
22+
:path: ".symlinks/plugins/video_player/ios"
23+
video_player_web:
24+
:path: ".symlinks/plugins/video_player_web/ios"
25+
26+
SPEC CHECKSUMS:
27+
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
28+
screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0
29+
video_player: 69c5f029fac4ffe4fc8a85ea7f7b793709661549
30+
video_player_web: da8cadb8274ed4f8dbee8d7171b420dedd437ce7
31+
32+
PODFILE CHECKSUM: e45c292f618eeca3034958d33b444b6e1249b55f
33+
34+
COCOAPODS: 1.8.4

‎day_11_02_video_player/ios/Runner.xcodeproj/project.pbxproj‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1818
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1919
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
20+
B6FA4327534DAABF4B42E00F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E8F658066E836BAF4664D2E /* Pods_Runner.framework */; };
2021
/* End PBXBuildFile section */
2122

2223
/* Begin PBXCopyFilesBuildPhase section */
@@ -39,6 +40,7 @@
3940
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
4041
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
4142
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
43+
5C8493090D13C340259F2FF1 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
4244
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
4345
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
4446
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
@@ -50,6 +52,9 @@
5052
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5153
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5254
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
55+
9E8F658066E836BAF4664D2E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
56+
B6BD3E1107578CA2B869F2FA /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
57+
D6922BBE17749DFB308BD84E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
5358
/* End PBXFileReference section */
5459

5560
/* Begin PBXFrameworksBuildPhase section */
@@ -59,12 +64,31 @@
5964
files = (
6065
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
6166
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
67+
B6FA4327534DAABF4B42E00F /* Pods_Runner.framework in Frameworks */,
6268
);
6369
runOnlyForDeploymentPostprocessing = 0;
6470
};
6571
/* End PBXFrameworksBuildPhase section */
6672

6773
/* Begin PBXGroup section */
74+
134C03D216154B53E35AA7D3 /* Frameworks */ = {
75+
isa = PBXGroup;
76+
children = (
77+
9E8F658066E836BAF4664D2E /* Pods_Runner.framework */,
78+
);
79+
name = Frameworks;
80+
sourceTree = "<group>";
81+
};
82+
8AC2A096C6BBC27CC51FC04E /* Pods */ = {
83+
isa = PBXGroup;
84+
children = (
85+
B6BD3E1107578CA2B869F2FA /* Pods-Runner.debug.xcconfig */,
86+
D6922BBE17749DFB308BD84E /* Pods-Runner.release.xcconfig */,
87+
5C8493090D13C340259F2FF1 /* Pods-Runner.profile.xcconfig */,
88+
);
89+
path = Pods;
90+
sourceTree = "<group>";
91+
};
6892
9740EEB11CF90186004384FC /* Flutter */ = {
6993
isa = PBXGroup;
7094
children = (
@@ -84,6 +108,8 @@
84108
9740EEB11CF90186004384FC /* Flutter */,
85109
97C146F01CF9000F007C117D /* Runner */,
86110
97C146EF1CF9000F007C117D /* Products */,
111+
8AC2A096C6BBC27CC51FC04E /* Pods */,
112+
134C03D216154B53E35AA7D3 /* Frameworks */,
87113
);
88114
sourceTree = "<group>";
89115
};
@@ -125,12 +151,14 @@
125151
isa = PBXNativeTarget;
126152
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
127153
buildPhases = (
154+
FE41933E53776DD65B9ABF05 /* [CP] Check Pods Manifest.lock */,
128155
9740EEB61CF901F6004384FC /* Run Script */,
129156
97C146EA1CF9000F007C117D /* Sources */,
130157
97C146EB1CF9000F007C117D /* Frameworks */,
131158
97C146EC1CF9000F007C117D /* Resources */,
132159
9705A1C41CF9048500538489 /* Embed Frameworks */,
133160
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
161+
AB5692C442EC25719E2716AA /* [CP] Embed Pods Frameworks */,
134162
);
135163
buildRules = (
136164
);
@@ -152,6 +180,7 @@
152180
TargetAttributes = {
153181
97C146ED1CF9000F007C117D = {
154182
CreatedOnToolsVersion = 7.3.1;
183+
DevelopmentTeam = Y5X465UP5R;
155184
LastSwiftMigration = 1100;
156185
};
157186
};
@@ -217,6 +246,43 @@
217246
shellPath = /bin/sh;
218247
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
219248
};
249+
AB5692C442EC25719E2716AA /* [CP] Embed Pods Frameworks */ = {
250+
isa = PBXShellScriptBuildPhase;
251+
buildActionMask = 2147483647;
252+
files = (
253+
);
254+
inputPaths = (
255+
);
256+
name = "[CP] Embed Pods Frameworks";
257+
outputPaths = (
258+
);
259+
runOnlyForDeploymentPostprocessing = 0;
260+
shellPath = /bin/sh;
261+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
262+
showEnvVarsInLog = 0;
263+
};
264+
FE41933E53776DD65B9ABF05 /* [CP] Check Pods Manifest.lock */ = {
265+
isa = PBXShellScriptBuildPhase;
266+
buildActionMask = 2147483647;
267+
files = (
268+
);
269+
inputFileListPaths = (
270+
);
271+
inputPaths = (
272+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
273+
"${PODS_ROOT}/Manifest.lock",
274+
);
275+
name = "[CP] Check Pods Manifest.lock";
276+
outputFileListPaths = (
277+
);
278+
outputPaths = (
279+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
280+
);
281+
runOnlyForDeploymentPostprocessing = 0;
282+
shellPath = /bin/sh;
283+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
284+
showEnvVarsInLog = 0;
285+
};
220286
/* End PBXShellScriptBuildPhase section */
221287

222288
/* Begin PBXSourcesBuildPhase section */
@@ -309,6 +375,7 @@
309375
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
310376
CLANG_ENABLE_MODULES = YES;
311377
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
378+
DEVELOPMENT_TEAM = Y5X465UP5R;
312379
ENABLE_BITCODE = NO;
313380
FRAMEWORK_SEARCH_PATHS = (
314381
"$(inherited)",
@@ -443,6 +510,7 @@
443510
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
444511
CLANG_ENABLE_MODULES = YES;
445512
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
513+
DEVELOPMENT_TEAM = Y5X465UP5R;
446514
ENABLE_BITCODE = NO;
447515
FRAMEWORK_SEARCH_PATHS = (
448516
"$(inherited)",
@@ -470,6 +538,7 @@
470538
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
471539
CLANG_ENABLE_MODULES = YES;
472540
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
541+
DEVELOPMENT_TEAM = Y5X465UP5R;
473542
ENABLE_BITCODE = NO;
474543
FRAMEWORK_SEARCH_PATHS = (
475544
"$(inherited)",

‎day_11_02_video_player/ios/Runner.xcworkspace/contents.xcworkspacedata‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

‎day_11_02_video_player/lib/main.dart‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class App extends StatelessWidget {
2121
}
2222
}
2323

24-
// TODO : must have to do this changes
24+
// TODO : must have to do these changes
25+
//—> videos can not play in iOS Simulator, you need real device
2526

2627
/*
2728
@@ -47,5 +48,20 @@ For iOS : video player configuration
4748
<true/>
4849
</dict>
4950
51+
*/
52+
53+
//----------------------
54+
55+
/*
56+
57+
Google : search like this : ( video player in android ) ( video player in ios ) that tutorial contains streaming url link.
58+
Sample video url = http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
59+
Smaple video url = https://gist.github.com/jsturgis/3b19447b304616f18657
60+
61+
62+
Default Video Player
63+
iOS = FLT VideoPlayer
64+
android = Exoplayer2
65+
5066
5167
*/
Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,47 @@
1+
import 'package:day_11_02_video_player/widgets/chewieVideoPlayerWidget.dart';
12
import 'package:flutter/material.dart';
3+
import 'package:video_player/video_player.dart';
4+
5+
enum VdoControllerType {
6+
fromAsset,
7+
fromNetwork,
8+
fromNetworkErrorLink,
9+
}
210

311
class ChewieVideoPlayerPage extends StatefulWidget {
412
@override
513
_ChewieVideoPlayerPageState createState() => _ChewieVideoPlayerPageState();
614
}
715

816
class _ChewieVideoPlayerPageState extends State<ChewieVideoPlayerPage> {
9-
String urlVideo =
10-
'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';
11-
1217
@override
1318
Widget build(BuildContext context) {
1419
return Scaffold(
1520
appBar: AppBar(title: Text('Chewie video player')),
16-
body: Container(),
21+
body: Container(
22+
color: Colors.green,
23+
child: ChewieVideoPlayerWidget(
24+
videoPlayerController: getDiffrentTypeOfVideoPlayerController(
25+
VdoControllerType.fromNetwork)),
26+
),
1727
);
1828
}
29+
30+
VideoPlayerController getDiffrentTypeOfVideoPlayerController(
31+
VdoControllerType type) {
32+
if (type == VdoControllerType.fromAsset) {
33+
return VideoPlayerController.asset('videos/SampleVideoWatering.mp4');
34+
} else if (type == VdoControllerType.fromNetwork) {
35+
return VideoPlayerController.network(
36+
'https://flutter.github.io/assets-for-api-docs/videos/butterfly.mp4',
37+
);
38+
} else if (type == VdoControllerType.fromNetworkErrorLink) {
39+
return VideoPlayerController.network(
40+
'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/error.mp4',
41+
);
42+
} else {
43+
//default return assets
44+
return VideoPlayerController.asset('videos/SampleVideoWatering.mp4');
45+
}
46+
}
1947
}
Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,75 @@
11
import 'package:flutter/material.dart';
2-
//import 'package:video_player/video_player.dart';
2+
import 'package:video_player/video_player.dart';
33

44
class DefaultVideoPlayerPage extends StatefulWidget {
55
@override
66
_DefaultVideoPlayerPageState createState() => _DefaultVideoPlayerPageState();
77
}
88

99
class _DefaultVideoPlayerPageState extends State<DefaultVideoPlayerPage> {
10-
String urlVideo =
11-
'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';
10+
VideoPlayerController _vdoPlayerController;
11+
Future _futureController;
12+
13+
@override
14+
void initState() {
15+
super.initState();
16+
_vdoPlayerController =
17+
VideoPlayerController.asset('videos/SampleVideoWatering.mp4');
18+
//_vdoPlayerController = VideoPlayerController.network('http://static.videokart.ir/clip/100/480.mp4');
19+
//https://flutter.github.io/assets-for-api-docs/videos/butterfly.mp4
20+
_futureController = _vdoPlayerController.initialize();
21+
}
22+
23+
@override
24+
void dispose() {
25+
super.dispose();
26+
_vdoPlayerController.dispose();
27+
}
1228

1329
@override
1430
Widget build(BuildContext context) {
1531
return Scaffold(
1632
appBar: AppBar(title: Text('Default video player')),
17-
body: Container(),
33+
floatingActionButton: _buildFloatingActionButton(),
34+
body: FutureBuilder(
35+
future: _futureController,
36+
builder: (context, snapshot) {
37+
if (snapshot.connectionState == ConnectionState.done) {
38+
return AspectRatio(
39+
aspectRatio: 16 / 9,
40+
//aspectRatio: _vdoPlayerController.value.aspectRatio,
41+
child: VideoPlayer(_vdoPlayerController),
42+
);
43+
} else {
44+
return Center(child: CircularProgressIndicator());
45+
}
46+
}),
1847
);
1948
}
49+
50+
FloatingActionButton _buildFloatingActionButton() {
51+
return FloatingActionButton(
52+
child: Icon(_vdoPlayerController.value.isPlaying
53+
? Icons.pause
54+
: Icons.play_arrow),
55+
onPressed: () {
56+
setState(() {
57+
if (_vdoPlayerController.value.isPlaying) {
58+
_vdoPlayerController.pause();
59+
} else {
60+
_vdoPlayerController.play();
61+
}
62+
});
63+
});
64+
}
2065
}
66+
67+
/*
68+
69+
AspectRatio(
70+
//aspectRatio: 16/9,
71+
aspectRatio: _vdoPlayerController.value.aspectRatio,
72+
child: VideoPlayer(_vdoPlayerController),
73+
),
74+
75+
*/

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /