TASK_1_FLUTTER_CREATING_AUDIO_&_VIDEO_PLAYER

Task Description:-

1.Create a flutter app.

2. Use assets (eg. audios and videos).

3. App will have to play this audios and videos from Assets.

4. Also add Features to play audio and video from Internet(Network).

5. Create buttons like play, pause and stop for audio and video both.

WHAT ARE ASSETS?

An asset is a file that is bundled and deployed with your app, and is accessible at runtime.

For creating an app. Go to the command prompt and in the working directory use flutter create <appname>. This command will create a folder in which we have all the necessary codes for running an app.

After creating the app we need to modify the code according to our desires. I’ll describe my code using the screenshots now.

For creating the audio player first install the plugin using the pubspec.yaml file and also give the assets path and write the location of the audio files and images

After changing the pubspec.yaml file save it and restart the IDE.

Now for the UI of the app I have used the material app and the top of it I have used the scaffold functions which gives a complete canvas for the app. After this i have first written the code for the appbar in which it will change the appbar color and gives us the title also it will give the action buttons.

Here I have used the Stack function so that on top of the image i can run multiple containers using the children widget.

For the play , pause , stop button to work i have defined some variables and function in the top of the Stateful widget.

I have used the stateful widget because there are some variables i need to change in the state of some variables and function and the stateless widget wont allow us to do that. Here the stop variable is initialized by the true value and the isplaying is initialized by the false so that the on pressing the play button it will on the music and similarly I have changed the value of these variables after the button is pressed as shown.

After doing this the app will look like this.

Also for the video to run I have used similar concepts . First i created another app and followed the same procedure by installing the required plugins and defining the assets path.

After this I have initialized the variables and functions values in the stateful widgets. Here i have used the video player to play the video online.

After doing this for the play pause button I have used the floating action button and write the necessary coding conditions in that block.

After doing this the video app will look something like this.

My plan is to use this floating action button in the audio app and if anyone press this button it will redirect to a new page and will start to play the video. For this part to complete I need some more time and also some more knowledge abut the widgets and classes. I have tried my best to do this task. And in future I will definitely improvise this project.

THANK YOU!!!

Github url:- https://github.com/akshat-crypto/task1_flutter.git

LinkedIN profile:- https://www.linkedin.com/in/akshat-soni-011b461a6