android -What is the best way to play video in my application - android

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 ?

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.

In android, .mp4 extension is the most common video format which is compatible for the default playback.
Objective:
Implemention of VideoView for the playback of Videos.
Usage of MediaController for the playback controls.
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?

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

Related

How to trim a video without using ffmpeg on Android?

I am building an application in which I need to trim videos. It is possible to do this using ffmpeg, but I can't use it because it uses the gpl license.
I tried using mediaCodec but can't use the codes I found.
How can i trim videos on android?
I had to develop trim functionality into my app a few months back and found that FFMPEG is very heavy and wasn't as accurate as MediaCodec.
None of the examples helped me but as I was developing in Kotlin I had to rewrite it anyway.
Here is the breakdown of how to use MediaCodec:
Pass the file to your mediacodec class
Extract the video from a file
Create your buffer size
Seek to where you want to file to be trimmed from or to
Mux your audio and video together
We tried to find a way to do the start and finish times together but we ended up just duplicating the clip first and passing both in with a start and and end time.
You'll need to post your code and show where you're having the issue with MediaCodec for people to help you.

Decoding a video on the fly in exoplayer

I'm using the Android ExoPlayer to play a video, but I want to implement some custom encoding mechanism.
The idea is to change certain bytes on the video file, so that it's not playable from standard players. And then in ExoPlayer perform the decoding on the fly (without actually modifying the stored file).
How could I do such a thing - using a custom DataSource? Any tips on this would be much appreciated!

what is the most efficient way to stream videos in android app

I am Building An app for on line streaming,using MediaPayer to stream videos,
player.setDataSource(this, Uri.parse(getLink()));
but his seems rather slow ,is there more efficient way to stream videos ,please guide
thanx in advance
is there more efficient way to stream videos ?
You could try using the VideoView class:
https://developer.android.com/reference/android/widget/VideoView.html
Displays a video file. The VideoView class can load images from
various sources (such as resources or content providers), takes care
of computing its measurement from the video so that it can be used in
any layout manager, and provides various display options such as
scaling and tinting.
or if you are willing to write some boiler plate code (mostly using dependency injection) you could try ExoPlayer.
https://developer.android.com/guide/topics/media/exoplayer.html
There is some excellent sample code in GitHub for ExoPlayer as well to get you started.

RTSP Client implementation on Android

I have seen many questions related to this. Nevertheless there is not an answer for mine I think.
I would like to use an already coded RTSP Client on Android to use with MediaCodec in order to capture a RTSP stream in H264 to then decode and display it. I have used VideoView and MediaPlayer which are well-known to support RTSP streaming in the .setDataSource method (file or rtsp/http path) (unlike MediaExtractor which only supports file or http), but the latency is to high for my purposes.
I would like to use MediaExtractor, but because of that limitation on the setDataSource method it seems to be not an option. Given this, I am searching for some help or examples (tutorial?) that I could use as RTSP Client on Android, or if someone has used MediaExtractor in some way to capture the RTSP stream its help is more than welcome as well.
Thank you so much guys!
rojiark
You can try https://github.com/fyhertz/libstreaming
You should know though that is LGPL, which means the rest of your project will become LGPL and if you distribute the application you must also distribute the source code if requested.

how to create custom video player with all controls

is any library is there for to play you-tube video as well as mp4 files, video player should contains all controls like play,pause,stop seek-to, get-frame, and video streaming etc. or can any one tell me how to create the same.
please help me.
thanks in advance..
As Pandy said, use the MediaPlayer. Just drag it in from your eclipse UI editor and then work on it as you would anything else in android such textviews, etc.
Take a look at the dev guide for more info
MediaPlayer

Categories

Resources