On Android device I am playing one video URL which is HLS video stream.
I am providing path for M3U8 file to android VideoView.
This M3U8 File has different versions of Video divided by bandwidth/bit rate (Variable bitrate video streams).
It is task of VideoView to detect the current bandwidth of the device to server connectivity and request the appropriate video stream, so that video plays smoothly.
But VideoView is not doing that, for example:
If my device has bandwidth of around 30 KBPS then VideoView is sending request for 90 KBPS video stream and because of that my video is not playing properly and also if my bandwidth is more and 1 MBPS then also it is requesting some random stream.
Can we improve VideoView's bandwidth detection and provide him with correct bandwidth values so that he can request for the proper video stream according to current bandwidth, does VideoView provides this type of API's or can we some how hack it.
Related
I am developing an android app which plays a video from a server where I stored my video content. But it takes too much time to play a video, using 300-400 kb/s it takes almost 15-20 sec.
I want to know what facts are related to stream faster and how can I solve my problem.
It could be:
The video bitrate is too high for the connection speed
The player initial buffering is too safe
If you're saying your network is 300-400kbps, you probably want to try converting your video to an adaptive format like HLS or DASH, where the player will detect the user's bandwidth and download the best quality version that can start quickly.
From there it could be player configuration, adjusting the amount of buffered video the player waits for before starting playback. But beware, reducing initial buffering can cause rebuffering later in playback.
I am trying to record the online streaming (Radio station) while station plays in MediaPlayer.
As android does not provide any way to record audio from MUSIC source (as we did for MIC, VOICE_UPLINK, etc).
So I have created a local web server in my app, and gives that local url to MediaPlayer to play station streaming.
In my local web service I did following:
Open URL connection from original stream url.
Create read buffer. Original stream url (bitrate / 8) E.g. bitrate = 128 kbps so buffer size will be ((128 / 8) * 1024) i.e. 16 KBps.
Get input stream, and read bytes from stream and write to output stream of web service.
MediaPlayer plays streaming without any problem. But when I record the audio then starting point of recording is wrong (E.g If I record audio from 5:15 minutes then recording starts from 5:20 minutes, 5 seconds audio data missed) and this difference increased as playing time increases.
In short: I have facing the problem fast downloading speed and slow playing speed by MediaPlayer.
Is my calculation is wrong to create read buffer size? how can I match the downloading and playing speed of MediaPlayer?
I am developing Android application which use media player to view Live stream url. Application showing video correct. I need to know that, can we set stream bit rates programmatically? Please check screen shot which showing 1500 kbps at top left side of video and I need to set it 350 kbps.
You cannot set the bitrate using a VideoView. If you want to control the bitrate you will need to decode the audio and video manually using something like FFmpeg. You can then use AudioTrack and OpenGL to play the audio and render the video at the desired bitrate.
I have done it using parsing m3u8 file and get bandwidth of that video.
I have made a Android streaming application that plays media from online URL's. For playing the media, I am using the
standard MediaPlayer class for playing media.
As per the Android documentation, it supports RTSP protocol for audio & video playback
http://developer.android.com/guide/appendix/media-formats.html
But when I am trying to play media from a RTSP URL, it gets connected but I am not able to hear any media
Following is one of those RTSP URL -
rtsp://sfera.live24.gr/sfera4132
Does anybody media have an idea of playing RTSP URL's through the Android MediaPlayer
Thanks
That link you provided has 3 audio tracks, with the first and last tracks appearing to be silent and don't contain any valid audio.
The middle track has audio (as per VLC). I don't know how Android deals with multiple audio tracks. I imagine you may get better results if you use links that only contain 1 audio and 1 video track at most.
I expect for an rtsp stream with multiple audio tracks, android is only going to play the first one as there is no user interface to select a specific audio stream, hence why you aren't hearing any audio.
If this is a stream from your own server, to hear the audio you should adjust the SDP file the valid audio track first. If this is not from your server, I don't know what you're options are.
I'm playing video on Android using media player via RTSP. The player takes about 12s to buffer before it starts playing. Anyone know how I can convince the player to buffer less? I have full control over the RTSP server and the SDP it returns.
As per usual, as soon as I decide I should ask a question I work out the answer. I have a line "b=AS:91" in my SDP. If I reduce the number the amount of buffering decreases - so b=AS:2 gives about 4 or 5s buffering.