I get this kind of link from the database tcp: //62.109.15.84: 1300. How can I play this video stream

video is transmitted in the format mpeg-ts, h.264 codecs and mpeg layer II

I reproduce this method

public void play(String address){ final Uri path = Uri.parse(address); videoView.setVideoURI(path); videoView.requestFocus(); videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { Log.d("START VIDEO", "start Uri"); videoView.start(); } }); } 
  • And what does it play at all if you omit Android? No one knows what is there for the data. - Vladyslav Matviienko
  • mpeg-ts, h.264 codecs and mpeg layer II - kalugin1912
  • one
    Try using this - github.com/VideoExpertsGroup/RTSPPlayer - Alex Crow

1 answer 1

This problem could be solved with the help of the library https://github.com/mrmaffen/vlc-android-sdk

 <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="false" > <FrameLayout android:id="@+id/player_surface_frame" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:foregroundGravity="clip_horizontal|clip_vertical" tools:ignore="true"> <SurfaceView android:id="@+id/player_surface" android:layout_width="480dp" android:layout_height="360dp" /> </FrameLayout> </FrameLayout> 

  public void play(String address) { mSurfaceView = (SurfaceView) globalView.findViewById(R.id.player_surface); mSurfaceHolder = mSurfaceView.getHolder(); mSurfaceFrame = (FrameLayout) globalView.findViewById(R.id.player_surface_frame); mMediaUrl = new String(address); try { mLibVLC = new LibVLC(); mLibVLC.setAout(mLibVLC.AOUT_AUDIOTRACK); mLibVLC.setVout(mLibVLC.VOUT_ANDROID_SURFACE); mLibVLC.setHardwareAcceleration(LibVLC.HW_ACCELERATION_FULL); mLibVLC.init(getContext()); } catch (LibVlcException e){ Log.e("TAG", e.toString()); } mSurface = mSurfaceHolder.getSurface(); mLibVLC.attachSurface(mSurface, VideoStreamFragment.this); mLibVLC.playMRL(mMediaUrl); }