Video_Player 0.6.1 Exoplayer Error

1,129 views
Skip to first unread message

Brian Duffy

unread,
Jun 25, 2018, 3:01:20 PM6/25/18
to Flutter Dev

I thought I would play with the new video_player 0.6.1 in Flutter since it was mentioned in the Release Candidate article that it had been improved upon. First I upgraded Flutter and my Dart Code plugin for VS Code. I opened up Android Studio and ran all the updates it told me to. I then ran Flutter Doctor ...


Doctor summary (to see all details, run flutter doctor -v):

[] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.5 17F77, locale en-US)

[] Android toolchain - develop for Android devices (Android SDK 27.0.3)

[!] iOS toolchain - develop for iOS devices (Xcode 9.4.1)

    ! CocoaPods out of date (1.5.0 is recommended).

        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.

        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.

        For more info, see https://flutter.io/platform-plugins

      To upgrade:

        brew upgrade cocoapods

        pod setup

[] Android Studio (version 3.1)

    ✗ Flutter plugin not installed; this adds Flutter specific functionality.

    ✗ Dart plugin not installed; this adds Dart specific functionality.

[!] VS Code (version 1.24.1)

[] Connected devices (1 available)


! Doctor found issues in 2 categories.


I made a minor change to the example code from video_player git page to load the video file from the emulators documents folder instead of streaming it from the web. this has works for me in previous versions ...


import 'package:video_player/video_player.dart';
import 'package:flutter/material.dart';
import 'dart:io';


void main() => runApp(VideoApp());

class VideoApp extends StatefulWidget {
@override
_VideoAppState createState() => _VideoAppState();
}

class _VideoAppState extends State<VideoApp> {
VideoPlayerController _controller;
bool _isPlaying = false;

@override
void initState() {
super.initState();

String videoFile = "/data/user/0/com.example.videotest/app_flutter/test.mp4";
File file = new File(videoFile);
_controller = new VideoPlayerController.file(file)

..addListener(() {
final bool isPlaying = _controller.value.isPlaying;
if (isPlaying != _isPlaying) {
setState(() {
_isPlaying = isPlaying;
});
}
})
..initialize().then((_) {
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
setState(() {});
});
}

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Video Demo',
home: Scaffold(
body: Center(
child: _controller.value.initialized
? AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
)
: Container(),
),
floatingActionButton: FloatingActionButton(
onPressed: _controller.value.isPlaying
? _controller.pause
child: Icon(
_controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
),
),
),
);
}
}

I just use the adb tool to move that video file to the emulator with the proper privileges ...
adb root
adb push ~/Documents/video_test/test.mp4 /data/user/0/com.example.videotest/app_flutter
the video file is the same one used in the example on the git page.

I modified my pubspec.yaml to specify the newest version of the video player
video_player: "^0.6.1"

I am trying to run this on an android emulator. I have tried targeting both Android 7.1.1 and 8.1

I am running on channel beta

Looks like an ExoPlayer issue. Any ideas?

Launching lib/main.dart on Android SDK built for x86 in debug mode...

Built build/app/outputs/apk/debug/app-debug.apk.

I/FlutterActivityDelegate( 5055): onResume setting current activity to this

I/ExoPlayerImpl( 5055): Init 623aa7f [ExoPlayerLib/2.8.0] [generic_x86, Android SDK built for x86, Google, 27]

I/VideoCapabilities( 5055): Unsupported profile 4 for video/mp4v-es

I/OMXClient( 5055): Treble IOmx obtained

D/        ( 5055): HostConnection::get() New Host Connection established 0xc917fc00, tid 5077

D/EGL_emulation( 5055): eglMakeCurrent: 0xe357e680: ver 3 0 (tinfo 0xd531c440)

D/SurfaceUtils( 5055): connecting to surface 0xc9279008, reason connectToSurface

I/MediaCodec( 5055): [OMX.google.h264.decoder] setting surface generation to 5176321

D/SurfaceUtils( 5055): disconnecting from surface 0xc9279008, reason connectToSurface(reconnect)

D/SurfaceUtils( 5055): connecting to surface 0xc9279008, reason connectToSurface(reconnect)

E/ACodec  ( 5055): [OMX.google.h264.decoder] setPortMode on output to DynamicANWBuffer failed w/ err -1010

I/ACodec  ( 5055): codec does not support config priority (err -1010)

I/OMXClient( 5055): Treble IOmx obtained

I/ACodec  ( 5055): codec does not support config priority (err -2147483648)

D/AudioTrack( 5055): Client defaulted notificationFrames to 6000 for frameCount 12000

D/MediaCodec( 5055): [OMX.google.h264.decoder] setting dataspace on output surface to #104

W/GrallocMapperPassthrough( 5055): buffer descriptor with invalid usage bits 0x2000

D/        ( 5055): HostConnection::get() New Host Connection established 0xc917ffc0, tid 5097

D/SoftwareRenderer( 5055): setting dataspace on output surface to #104

I/zygote  ( 5055): Background concurrent copying GC freed 518(179KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 3MB/7MB, paused 5.215ms total 107.400ms

I/zygote  ( 5055): Do partial code cache collection, code=29KB, data=24KB

I/zygote  ( 5055): After code cache collection, code=29KB, data=24KB

I/zygote  ( 5055): Increasing code cache capacity to 128KB

Brian Duffy

unread,
Jun 25, 2018, 3:44:30 PM6/25/18
to Flutter Dev
I should have mentioned that I am running the Android 8.1 (Oreo) SDK. There is one more recent SDK available to install called Android API 28
Reply all
Reply to author
Forward
0 new messages