Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display black screen when switching between cached videos #121

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/widgets/story_image.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:async';
import 'dart:ui' as ui;
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';

import '../utils.dart';
Expand Down Expand Up @@ -46,8 +46,9 @@ class ImageLoader {

this.state = LoadState.success;

PaintingBinding.instance!.instantiateImageCodec(imageBytes).then(
(codec) {
ImmutableBuffer.fromUint8List(imageBytes)
.then((buffer) => instantiateImageCodecFromBuffer(buffer))
.then((codec) {
this.frames = codec;
onComplete();
}, onError: (error) {
Expand Down
19 changes: 11 additions & 8 deletions lib/widgets/story_video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,17 @@ class StoryVideoState extends State<StoryVideo> {
}

Widget getContentView() {
if (widget.videoLoader.state == LoadState.success &&
playerController!.value.isInitialized) {
return Center(
child: AspectRatio(
aspectRatio: playerController!.value.aspectRatio,
child: VideoPlayer(playerController!),
),
);
if (widget.videoLoader.state == LoadState.success) {
if (playerController!.value.isInitialized) {
return Center(
child: AspectRatio(
aspectRatio: playerController!.value.aspectRatio,
child: VideoPlayer(playerController!),
),
);
} else {
return Container();
}
}

return widget.videoLoader.state == LoadState.loading
Expand Down
1 change: 0 additions & 1 deletion lib/widgets/story_view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:math';
import 'dart:ui';

import 'package:collection/collection.dart' show IterableExtension;
import 'package:flutter/material.dart';
Expand Down
Loading