Getting Video View data as an inputstream - android

I am working on an application which plays hls streams from a server. I have used Video view for playing the stream. But now I need the stream data for some background processing. Is it possible to get the stream data which is currently playing in the video view as an inputstream??

Related

Very long MediaExtractor delay/latency for online audio stream

I'm writing a small (personal use) app that plays an audio stream from the internet. The stream is an AAC audio stream. I can play that stream just fine on linux through mpv and it plays immediately with no perceivable latency.
On Android, I'm first creating a MediaExtractor to extract the data to decode, like this:
// tested URLs:
// https://r.dcs.redcdn.pl/sc/o2/Eurozet/live/audio.livx
// https://rs101-krk.rmfstream.pl/RMFFM48
String streamSource = ...;
MediaExtractor extractor = new MediaExtractor();
extractor.setDataSource(streamSource);
extractor.selectTrack(0);
// it takes ~5 seconds to get there
this.format = extractor.getTrackFormat(0);
And for some reason there is a few seconds of delay from beginning downloading data to actually being able to get any information (like even track count, or select a track) from MediaExtractor. This is both when I construct it with a URL and when I create my own StreamMediaSource, and in this case it actually outputs any information after first reading about 130-150kiB of data, which at 64kbps is 16+ seconds of audio.
Is there any way to replicate the instant playback I can get on a PC? Why does it have to read that much data to proceed?

Get Current Hls Stream Duration ExoPlayer

I use ExoPlayer library for my Hls live broadcast.
I have started a live stream with wirecast. Broadcast is in the second hour. But when test the stream with my android application, it always starts at 0. How to I get real duration on server with Exoplayer?

How to control remote rtsp server using playbin

I'm working with gstreamer and I can play RTSP stream using below code:
data->pipeline = gst_parse_launch("playbin", &error);
//avi.sdp is a video file that in server
g_object_set(data->pipeline, "uri", "rtsp://192.168.1.1/avi.sdp", NULL);
When stream playing , i can pause it,
gst_element_set_state (data->pipeline, GST_STATE_PAUSED);
then when I set playing again, it restart playing!
gst_element_set_state (data->pipeline, GST_STATE_PLAYING);
is playbin support rtsp stream play & pause? if not, how can I implement this?

Android VideoView Buffer size

I have a android application that plays HLS (Http Live Streaming) videos using VideoView.
I am using Local http proxy for forwarding http requests from VideoView to main HLS server as my stream (transport segment) is encrypted.
Flow of my application:
0. Preparing VideoView with local proxy url. ex. "http:// localhost :9878/index.m3u8"
1. VideoView sends requests to my proxy for M3U8 and ts segments.
2. Proxy forwards requests for M3u8 and ts from VideoView to HLS server.
3. Proxy checks for transport stream requests and before sending response to VideoView decrypts transport stream and sends it to VideoView.
4. VideoView plays the video stream.
This is working properly but some times i get following error:
output buffer is smaller than decoded data size Out Length
When i get this error in logcat my video becomes garbage (green video)
I see this issue usually when video stream bitrate size increases, is there any workaround for this issue?

Hot to get live streaming data in android

I am trying to make an app which gets livestreaming camera videos. I can stream my webcam from my laptop on the ip (for example ip:176.33.226.53:8070), by using the 1AVStreaming program but I can't reach the streaming video in my code.
Media Player can directly work with the url itself.
Look for something like
Uri myUri = Uri.parse("http://your/video/file/path");
MediaPlayer player = new MediaPlayer();
player.setDataSource(context, myUri);
player.prepare();
Use MediaPlayer.OnPreparedListener to show controls or start the video
Their are various examples available. Just Google It

Categories

Resources