Получить необработанные видеоданные из ExoPlayer в мобильном приложении Java ⇐ JAVA
-
Anonymous
Получить необработанные видеоданные из ExoPlayer в мобильном приложении Java
i am trying to stream my RTSP camera to my mobile app which is written in Java, I used exoPlayer to view the video and it is working fine, here is my code:
import android.content.Context; import android.net.Uri; import android.util.Log; import androidx.annotation.OptIn; import androidx.media3.common.MediaItem; import androidx.media3.common.Player; import androidx.media3.common.util.UnstableApi; import androidx.media3.exoplayer.ExoPlayer; import androidx.media3.exoplayer.rtsp.RtspMediaSource; import androidx.media3.exoplayer.source.MediaSource; public class VideoStreamer { private ExoPlayer player; private final Context context; public VideoStreamer(Context context) { this.context = context; initializePlayer(); } @OptIn(markerClass = UnstableApi.class) private void initializePlayer() { Log.d("", "initializePlayer: "); player = new ExoPlayer.Builder(context).build(); Uri rtspUri = Uri.parse("my_rtsp_link"); MediaSource mediaSource = new RtspMediaSource.Factory().createMediaSource(MediaItem.fromUri(rtspUri)); player.setMediaSource(mediaSource); player.prepare(); } public ExoPlayer getPlayer() { return player; } public void releasePlayer() { if (player != null) { player.release(); player = null; } } } now my problem is I don't know how to get the data frames or raw data from the camera I am streaming on,
I looked for some solutions such as using MediaCodec, but I didn't know how to do so, my plan is to send these data to an API
Источник: https://stackoverflow.com/questions/780 ... mobile-app
i am trying to stream my RTSP camera to my mobile app which is written in Java, I used exoPlayer to view the video and it is working fine, here is my code:
import android.content.Context; import android.net.Uri; import android.util.Log; import androidx.annotation.OptIn; import androidx.media3.common.MediaItem; import androidx.media3.common.Player; import androidx.media3.common.util.UnstableApi; import androidx.media3.exoplayer.ExoPlayer; import androidx.media3.exoplayer.rtsp.RtspMediaSource; import androidx.media3.exoplayer.source.MediaSource; public class VideoStreamer { private ExoPlayer player; private final Context context; public VideoStreamer(Context context) { this.context = context; initializePlayer(); } @OptIn(markerClass = UnstableApi.class) private void initializePlayer() { Log.d("", "initializePlayer: "); player = new ExoPlayer.Builder(context).build(); Uri rtspUri = Uri.parse("my_rtsp_link"); MediaSource mediaSource = new RtspMediaSource.Factory().createMediaSource(MediaItem.fromUri(rtspUri)); player.setMediaSource(mediaSource); player.prepare(); } public ExoPlayer getPlayer() { return player; } public void releasePlayer() { if (player != null) { player.release(); player = null; } } } now my problem is I don't know how to get the data frames or raw data from the camera I am streaming on,
I looked for some solutions such as using MediaCodec, but I didn't know how to do so, my plan is to send these data to an API
Источник: https://stackoverflow.com/questions/780 ... mobile-app
Мобильная версия