App-Brewery-Flutter-Null-Safety icon indicating copy to clipboard operation
App-Brewery-Flutter-Null-Safety copied to clipboard

Request to Replace the steps Section 9 AudioPlayer

Open MiladZarour opened this issue 3 years ago • 2 comments

I am getting this error

I/zygote ( 9419): Do partial code cache collection, code=17KB, data=21KB I/zygote ( 9419): After code cache collection, code=17KB, data=21KB I/zygote ( 9419): Increasing code cache capacity to 128KB D/EGL_emulation( 9419): eglMakeCurrent: 0xdc304780: ver 2 0 (tinfo 0xdc3038e0) V/MediaPlayer( 9419): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false V/MediaPlayer( 9419): cleanDrmObj: mDrmObj=null mDrmSessionId=null V/MediaPlayer( 9419): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false V/MediaPlayer( 9419): cleanDrmObj: mDrmObj=null mDrmSessionId=null V/MediaPlayer( 9419): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false V/MediaPlayer( 9419): cleanDrmObj: mDrmObj=null mDrmSessionId=null

MiladZarour avatar Dec 10 '22 18:12 MiladZarour

I have tried a lot other solutions as well and I am getting in the end the same error

I am getting this error

I/zygote ( 9419): Do partial code cache collection, code=17KB, data=21KB I/zygote ( 9419): After code cache collection, code=17KB, data=21KB I/zygote ( 9419): Increasing code cache capacity to 128KB D/EGL_emulation( 9419): eglMakeCurrent: 0xdc304780: ver 2 0 (tinfo 0xdc3038e0) V/MediaPlayer( 9419): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false V/MediaPlayer( 9419): cleanDrmObj: mDrmObj=null mDrmSessionId=null V/MediaPlayer( 9419): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false V/MediaPlayer( 9419): cleanDrmObj: mDrmObj=null mDrmSessionId=null V/MediaPlayer( 9419): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false V/MediaPlayer( 9419): cleanDrmObj: mDrmObj=null mDrmSessionId=null

and this is the code I am using :

import 'package:flutter/material.dart';
import 'package:audioplayers/audioplayers.dart';
 
void main() => runApp(XylophoneApp());
 
class XylophoneApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Center(
            child: TextButton(
              onPressed: () async {
                final player = AudioPlayer();
                await player.play(
                  AssetSource('note1.wav'),
                );
              },
              child: Text("Play me"),
            ),
          ),
        ),
      ),
    );
  }
}

MiladZarour avatar Dec 10 '22 20:12 MiladZarour

import 'package:flutter/material.dart';
import 'package:audioplayers/audioplayers.dart';

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

class XylophoneApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final player = AudioPlayer();

    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Center(
            child: TextButton(
              onPressed: () async {
                await player.play(AssetSource('note1.wav'));
              },
              child: Text("Click me"),
            ),
          ),
        ),
      ),
    );
  }
}

Today I tried to run this code, and it works ! but before that , I went to the folder asset/note1.wav , and I double click on that then I run flutter , and clicked , and PINNNNNNNN , it works !!!!!

MiladZarour avatar Dec 11 '22 08:12 MiladZarour