mrmaffen / vlc-android-sdk

VLC Android SDK pushed to Maven Central. Primarily used in project tomahawk-android.
792 stars 244 forks source link

How to force client to switch RTP transport from UDP to TCP? #90

Closed MinChanSike closed 7 years ago

MinChanSike commented 7 years ago

How to switch RTP/RTSP streaming from UDP to TCP as default? Android client support UDP as default, How to force for TCP based connection over the RTSP port. Want to change RTP over RTSP.

MinChanSike commented 7 years ago

It's can solve by adding MediaOptions :rtsp-tcp at playMRL method.

public void playMRL(String mrl) {
        // index=-1 will return options from libvlc instance without relying on MediaList
        String[] options = mMediaList.getMediaOptions(-1);
        options = AppendArrayItem(options, ":rtsp-tcp"); //<- Add code
        mInternalMediaPlayerIndex = 0;
        playMRL(mLibVlcInstance, mrl, options);
}
public static <T> T[] AppendArrayItem(T[] arr, T element) {
        final int N = arr.length;
        arr = Arrays.copyOf(arr, N + 1);
        arr[N] = element;
        return arr;
}