2016-06-22 6 views
2

현재 Android 용 VLC를 사용하여 네트워크 스트림을 재생할 때 문제가 있습니다.libvlc Android : HTTP 네트워크 스트림을 재생할 수 없습니다.

기본적으로이 가이드 https://wiki.videolan.org/AndroidCompile/을 따라 복제 한 후 모든 항목이 올바르게 작동하며 내 응용 프로그램을 실행하고 (로컬 또는 네트워크에서) 비디오를 재생할 수 있습니다.

나는 libvlc AAR을 가져 와서 처음부터 새로운 Android 프로젝트를 만들었습니다. 로컬 비디오를 재생할 수 있지만 URL을 전달하면 스트림이 열리지 않습니다.

관련 코드 :

// Create LibVLC 
ArrayList<String> options = new ArrayList<String>(); 
options.add("--aout=opensles"); 
options.add("--audio-time-stretch"); // time stretching 
options.add("-vvv"); // verbosity 
libvlc = new LibVLC(options); 
holder.setKeepScreenOn(true); 

// Create media player 
mMediaPlayer = new MediaPlayer(libvlc); 
mMediaPlayer.setEventListener(mPlayerListener); 

// Set up video output 
final IVLCVout vout = mMediaPlayer.getVLCVout(); 
vout.setVideoView(mSurface); 
vout.addCallback(this); 
vout.attachViews(); 

Media m = new Media(libvlc, Uri.parse(media)); 
mMediaPlayer.setMedia(m); 
mMediaPlayer.play(); 

media는 URL에 대한 String입니다.

내 구성 (모듈)에 누락 된 항목이 있습니까? 여기

내가 얻을 로그입니다 :

D/LibVLCAndroidSample: Playing back http://jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv 
D/Activity: performCreate Call Injection manager 
I/InjectionManager: dispatchOnViewCreated > Target : com.compdigitec.libvlcandroidsample.VideoActivity isFragment :false 
D/VLC: [ede46778/0] core libvlc: VLC media player - 3.0.0-git Vetinari 
D/VLC: [ede46778/5f726f74] core libvlc: Copyright © 1996-2016 the VideoLAN team 
D/VLC: [ede46778/190019] core libvlc: revision 2.2.0-git-7900-g640a891 
D/VLC: [ede46778/190019] core libvlc: configured with ../configure '--host=arm-linux-androideabi' '--build=x86_64-unknown-linux' '--enable-neon' '--disable-nls' '--enable-live555' '--enable-realrtsp' '--enable-avformat' '--enable-swscale' '--enable-avcodec' '--enable-opus' '--enable-opensles' '--enable-mkv' '--enable-taglib' '--enable-dvbpsi' '--disable-vlc' '--disable-shared' '--disable-update-check' '--disable-vlm' '--disable-dbus' '--enable-lua' '--disable-vcd' '--disable-v4l2' '--disable-gnomevfs' '--enable-dvdread' '--enable-dvdnav' '--disable-bluray' '--disable-linsys' '--disable-decklink' '--disable-libva' '--disable-dv1394' '--enable-mod' '--disable-sid' '--disable-gme' '--disable-tremor' '--enable-mad' '--disable-dca' '--disable-sdl-image' '--enable-zvbi' '--disable-fluidsynth' '--disable-jack' '--disable-pulse' '--disable-alsa' '--disable-samplerate' '--disable-sdl' '--disable-xcb' '--disable-atmo' '--disable-qt' '--disable-skins2' '--disable-mtp' '--disable-notify' '--enable-libass' '--disable-svg' '--d 
D/VLC: [ede46778/eb81c760] core libvlc: plug-ins loaded: 275 modules 
D/VLC: [ee93d168/eb81c760] core logger: looking for logger module matching "any": 4 candidates 
D/VLC: [ee93d168/10001] core logger: using logger module "android_logger" 
D/VLC: [ede46778/2a98] core libvlc: translation test: code is "C" 
D/VLC: [ee93d1c8/2a98] core keystore: looking for keystore module matching "memory": 3 candidates 
D/VLC: [ee93d1c8/2a98] core keystore: using keystore module "memory" 
D/VLC: [ede46778/2a98] core libvlc: CPU has capabilities ARM_NEON FPU 
D/VLC: [ede472d8/2a98] core generic: creating audio output 
D/VLC: [f4e4bda8/2a98] core audio output: looking for audio output module matching "opensles": 4 candidates 
W/libOpenSLES: class OutputMix interface 0 requested but unavailable MPH=43 
D/VLC: [f4e4bda8/2a98] core audio output: using audio output module "opensles_android" 
D/VLC: [ede472d8/2a98] core generic: keeping audio output 
D/SecWifiDisplayUtil: Metadata value : SecSettings2 
D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{22a16c1 I.E...... R.....ID 0,0-0,0} 
D/mali_winsys: new_window_surface returns 0x3000, [1440x2560]-format:1 
D/VLC: [ee923df8/2a98] core input: Creating an input for 'jellyfish-3-mbps-hd-h264.mkv' 
D/VLC: [ee923df8/2dbb] core input: using timeshift granularity of 50 MiB 
D/VLC: [ee923df8/2dbb] core input: using default timeshift path 
D/VLC: [ee923df8/2dbb] core input: `http://jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv' gives access `http' demux `' path `jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv' 
D/VLC: [f4ebbbc8/2dbb] core input source: specified demux: any 
D/VLC: [f4ebbbc8/2dbb] core input source: creating demux: access='http' demux='any' location='jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv' file='(null)' 
D/VLC: [ee93be28/2dbb] core demux: looking for access_demux module matching "http": 6 candidates 
D/VLC: [ee93be28/2dbb] core demux: no access_demux modules matched 
D/VLC: [ee93bea8/2dbb] core access: creating access: http://jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv 
D/VLC: [ee93bea8/2dbb] core access: looking for access module matching "http": 22 candidates 
D/VLC: [ee93bea8/2dbc] transport access: resolving jell.yfish.us ... 
E/VLC: [ee93bea8/2dbc] transport access: cannot resolve jell.yfish.us port 80: No address associated with hostname 
E/VLC: [ee93bea8/2dbb] access access: HTTP connection failure 
D/VLC: [ee93bea8/2dbb] http access: querying proxy for http://jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv 
D/VLC: [ee93bea8/2dbb] http access: no proxy 
D/VLC: [ee93bea8/2dbb] http access: http: server='jell.yfish.us' port=80 file='/media/jellyfish-3-mbps-hd-h264.mkv' 
D/VLC: [ee93bea8/2dbb] core access: net: connecting to jell.yfish.us port 80 
E/VLC: [ee93bea8/2dbb] core access: cannot resolve jell.yfish.us port 80 : No address associated with hostname 
E/VLC: [ee93bea8/2dbb] http access: cannot connect to jell.yfish.us:80 
D/VLC: [ee93bea8/2dbb] core access: no access modules matched 
E/VLC: [f4ebbbc8/2dbb] core input source: cannot access http://jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv 
E/VLC: [ee923df8/2dbb] core input: Your input can't be opened 
E/VLC: [ee923df8/2dbb] core input: VLC is unable to open the MRL 'http://jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv'. Check the log for details. 

답변

2

libvlc 코드에서 비트를 파고 후, 나는이 문제의 원인은 정말 간단했다 깨닫고 난 사실 내가 생각하지 않았다 행복하지 않다 그것 전에.

어쨌든 가장 똑똑한 것을 확인하기 전에 같은 문제를 겪고있는 사람을 위해 libvlc을 파헤 치기 시작합니다.

기본적으로 나는 매니페스트에 INTERNET 권한을 잃어버린 : 당신이 돈 때문에

<uses-permission android:name="android.permission.INTERNET" /> 

로그는, 렌더링은 UI 스레드에서 수행되지 아마 때문에, 특별히 안드로이드 측면에서 매우 명확하지 않다 ' 보통 NetworkOnMainThreadException을 얻지 마십시오.