5

I've encounter this problem many times , the problem is that I've a videoView in my application but it couldn't play lots of different formats and video files.

for example , if I want to open a mp4 file, I should ask my users to convert the video to a H.264 format and then upload the file and it's very hard.

I'm looking for a better way to play various formats of videos .

Does any one no any way to do so ? have can I do that ?

donald draper
  • 561
  • 2
  • 9
  • 24

3 Answers3

2

If you're willing to use a third party library, FFmpegMediaPlayer is a is a reimplementation of Android's MediaPlayer class based on FFmpeg. It adds support for additional formats and protocols not provided by Android's MediaPlayer class. It is licensed under LGPLv2.1.

cwbowron
  • 1,015
  • 6
  • 10
1

In android, .mp4 extension is the most common video format which is compatible for the default playback.

Objective:

  1. Implemention of VideoView for the playback of Videos.

  2. Usage of MediaController for the playback controls.

  3. SurfaceView which will hold the playback of Videos.

Containers that are used for playing videos:

VideoView

MediaController

SurfaceView

DisplayMetrics

Read more: http://mrbool.com/how-to-play-video-formats-in-android-using-videoview/28299#ixzz3uUX2Bew0

Or for getting best answer , you need to see this link.

Best way to play a Video file?

Community
  • 1
  • 1
KishuDroid
  • 5,411
  • 4
  • 30
  • 47
0

I suggest you to try out ExoPlayer. It has really nice features and documentations. Try this codelabs tutorial. https://codelabs.developers.google.com/codelabs/exoplayer-intro/#0

Parinda Rajapaksha
  • 2,963
  • 1
  • 36
  • 40