내 카메라 피드를 VLC 미디어 플레이어로 라이브 스트리밍하기 위해 Android에서 경량 RTSP 서버를 구현하려고합니다. 이를 위해 libstreaming 라이브러리를 사용 하고 있습니다. Android Studio에서 라이브러리를 성공적으로 가져 왔고 서버 측 의 스켈레톤 코드 를 컴파일하고 실행했습니다 . 불행히도 프로그램이 예상대로 작동하지 않습니다. 카메라 미리보기가로드되지 않고 VLC 미디어 플레이어에서 MRL을 읽을 수 없습니다. 전에이 문제에 직면 한 사람이 있습니까? 어떤 도움을 주시면 감사하겠습니다! 미리 감사드립니다. 지금까지 시도한 내용은 다음과 같습니다.
public class MainActivity extends Activity {
private final static String TAG = "MainActivity";
private SurfaceView mSurfaceView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mSurfaceView = (SurfaceView) findViewById(R.id.surface);
// Sets the port of the RTSP server to 1234
Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
editor.putString(RtspServer.KEY_PORT, String.valueOf(1234));
editor.commit();
// Configures the SessionBuilder
SessionBuilder.getInstance()
.setSurfaceView(mSurfaceView)
.setPreviewOrientation(90)
.setContext(getApplicationContext())
.setAudioEncoder(SessionBuilder.AUDIO_NONE)
.setVideoEncoder(SessionBuilder.VIDEO_H264);
// Starts the RTSP server
this.startService(new Intent(this,RtspServer.class));
}
}
MRL에 액세스하려고합니다 : rtsp : //192.168.2.3 : 1234 /
시도중인 코드가 좋습니다. URL은 특정 형식을 가져야합니다.
VLC 플레이어의 URL은 rtsp : // phone_local_ip : 1234? h264 = 200-20-320-240이어야합니다.
200 = buf | 20 = fps | 320 = 너비 | 240 = 높이
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다