Help With Playing YouTube Video
I have been trying to figure out how to play a YouTube link for a while now and cannot seem to figure it out. I have used several resources and still cannot get a proper link to stream the video. Could anyone steer me in the right direction. Below is the code I am using, and the error log I am receiving.
final ArrayList<String> args = new ArrayList<>();
args.add("-vvv");
args.add("--no-drop-late-frames");
args.add("--no-skip-frames");
LibVLC mLibVLC = new LibVLC(this, args);
Media m = new Media(mLibVLC, Uri.parse("https://www.youtube.com/watch?v=hwdjpbKG3h"));
m.addOption(":no-http-forward-cookies");
if(m.parse(IMedia.Parse.ParseNetwork)){
Log.d("youtubeVal",m.subItems().getCount()+"");
}
This is the error log as you can see the last one states 0 for the media count which makes no sense.
2021-12-01 09:13:37.452 6775-6805/com.example.app D/EGL_emulation: eglMakeCurrent: 0xe3a1a240: ver 2 0 (tinfo 0xe3a0f210)
2021-12-01 09:13:38.872 6775-6775/com.example.app D/VLC: [e0642430/765f7070] libvlc libvlc: VLC media player - 3.0.16 Vetinari
2021-12-01 09:13:38.872 6775-6775/com.example.app D/VLC: [e0642430/10] libvlc libvlc: Copyright © 1996-2021 the VideoLAN team
2021-12-01 09:13:38.872 6775-6775/com.example.app D/VLC: [e0642430/10] libvlc libvlc: revision 3.0.16-158-g02562d307f
2021-12-01 09:13:38.872 6775-6775/com.example.app D/VLC: [e0642430/0] libvlc libvlc: configured with ../configure '--host=i686-linux-android' '--build=x86_64-unknown-linux' '--with-contrib=/builds/videolan/vlc-android/vlc/contrib/i686-linux-android' '--prefix=/builds/videolan/vlc-android/vlc/build-android-i686-linux-android/install/' '--with-pic' '--disable-nls' '--enable-live555' '--enable-realrtsp' '--enable-avformat' '--enable-swscale' '--enable-avcodec' '--enable-opus' '--enable-opensles' '--enable-matroska' '--enable-taglib' '--enable-dvbpsi' '--disable-vlc' '--disable-shared' '--disable-update-check' '--disable-vlm' '--disable-dbus' '--enable-lua' '--disable-vcd' '--disable-v4l2' '--enable-dvdread' '--enable-dvdnav' '--enable-bluray' '--disable-linsys' '--disable-decklink' '--disable-libva' '--disable-dv1394' '--enable-mod' '--disable-sid' '--disable-gme' '--disable-tremor' '--disable-mad' '--enable-mpg123' '--disable-dca' '--disable-sdl-image' '--enable-zvbi' '--disable-fluidsynth' '--enable-fluidlite' '--disable-jack' '--disable-pulse' '--disable-alsa' '-
2021-12-01 09:13:38.872 6775-6775/com.example.app D/VLC: [e0642430/e0651280] libvlc libvlc: plug-ins loaded: 373 modules
2021-12-01 09:13:38.872 6775-6775/com.example.app D/VLC: [f6e7e890/10] libvlc logger: looking for logger module matching "any": 4 candidates
2021-12-01 09:13:38.872 6775-6775/com.example.app D/VLC: [f6e7e890/10] libvlc logger: using logger module "android_logger"
2021-12-01 09:13:38.872 6775-6775/com.example.app D/VLC: [e0642430/1a77] libvlc libvlc: translation test: code is "C"
2021-12-01 09:13:38.872 6775-6775/com.example.app D/VLC: [f6e7f310/1a77] libvlc keystore: looking for keystore module matching "memory": 3 candidates
2021-12-01 09:13:38.872 6775-6775/com.example.app D/VLC: [f6e7f310/1a77] libvlc keystore: using keystore module "memory"
2021-12-01 09:13:38.901 6775-6775/com.example.app D/VLC: [e0642430/1a77] libvlc libvlc: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2 FPU
2021-12-01 09:13:38.904 6775-6857/com.example.app D/VLC: [cc56dc30/1ac9] libvlc input: Creating an input for preparsing 'watch?v=hwdjpbKG3h'
2021-12-01 09:13:38.905 6775-6858/com.example.app D/VLC: [cc56dc30/1aca] libvlc input: using timeshift granularity of 50 MiB
2021-12-01 09:13:38.905 6775-6858/com.example.app D/VLC: [cc56dc30/1aca] libvlc input: using default timeshift path
2021-12-01 09:13:38.905 6775-6858/com.example.app D/VLC: [cc56dc30/1aca] libvlc input: `https://www.youtube.com/watch?v=hwdjpbKG3h' gives access `https' demux `any' path `www.youtube.com/watch?v=hwdjpbKG3h'
2021-12-01 09:13:38.905 6775-6858/com.example.app D/VLC: [e05d68b0/1aca] libvlc demux: looking for access_demux module matching "https": 7 candidates
2021-12-01 09:13:38.905 6775-6858/com.example.app D/VLC: [e05d68b0/1aca] libvlc demux: no access_demux modules matched
2021-12-01 09:13:38.905 6775-6858/com.example.app D/VLC: [e05d6950/1aca] libvlc stream: creating access: https://www.youtube.com/watch?v=hwdjpbKG3h
2021-12-01 09:13:38.905 6775-6858/com.example.app D/VLC: [e05d6950/1aca] libvlc stream: looking for access module matching "https": 25 candidates
2021-12-01 09:13:38.905 6775-6858/com.example.app D/VLC: [ebb6fc50/1aca] libvlc tls client: looking for tls client module matching "any": 1 candidates
2021-12-01 09:13:38.905 6775-6858/com.example.app D/VLC: [ebb6fc50/1aca] libvlc tls client: using GnuTLS version 3.6.15
2021-12-01 09:13:38.918 6775-6858/com.example.app D/VLC: [ebb6fc50/1aca] libvlc tls client: loaded 138 trusted CAs from system
2021-12-01 09:13:38.919 6775-6858/com.example.app D/VLC: [ebb6fc50/1aca] libvlc tls client: using tls client module "gnutls"
2021-12-01 09:13:38.919 6775-6858/com.example.app D/VLC: [ebb6fc50/1aca] libvlc tls client: resolving www.youtube.com ...
2021-12-01 09:13:38.944 6775-6858/com.example.app D/VLC: [ebb6fc50/1aca] libvlc tls client: TLS handshake: Resource temporarily unavailable, try again.
2021-12-01 09:13:38.974 6775-6858/com.example.app D/VLC: [ebb6fc50/1aca] libvlc tls client: TLS handshake: Success.
2021-12-01 09:13:38.976 6775-6858/com.example.app D/VLC: [e05d6950/1aca] http stream: out SETTINGS (0x04) frame of 30 bytes, flags 0x00, global
2021-12-01 09:13:38.977 6775-6858/com.example.app D/VLC: [e05d6950/1aca] http stream: out HEADERS (0x01) frame of 171 bytes, flags 0x05, stream 1
2021-12-01 09:13:38.994 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: in SETTINGS (0x04) frame of 18 bytes, flags 0x00, global
2021-12-01 09:13:38.994 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: setting: Concurrent streams (0x0003): 100
2021-12-01 09:13:38.994 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: setting: Initial window size (0x0004): 1048576
2021-12-01 09:13:38.994 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: setting: Header list size (0x0006): 65536
2021-12-01 09:13:38.994 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: out SETTINGS (0x04) frame of 0 bytes, flags 0x01, global
2021-12-01 09:13:38.994 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: in WINDOW_UPDATE (0x08) frame of 4 bytes, flags 0x00, global
2021-12-01 09:13:38.994 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: in SETTINGS (0x04) frame of 0 bytes, flags 0x01, global
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: in HEADERS (0x01) frame of 994 bytes, flags 0x04, stream 1
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: stream 1 19 headers:
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: :status: "200"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: content-type: "text/html; charset=utf-8"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: x-content-type-options: "nosniff"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: cache-control: "no-cache, no-store, max-age=0, must-revalidate"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: pragma: "no-cache"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: expires: "Mon, 01 Jan 1990 00:00:00 GMT"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: date: "Wed, 01 Dec 2021 17:13:40 GMT"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: x-frame-options: "SAMEORIGIN"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: strict-transport-security: "max-age=31536000"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: permissions-policy: "ch-ua-arch=*, ch-ua-bitness=*, ch-ua-full-version=*, ch-ua-model=*, ch-ua-platform=*, ch-ua-platform-version=*"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: report-to: "{"group":"AXrpQdexiF0ssZ_nH8Dr-M3QgbdVRvO77RECMA","max_age":2592000,"endpoints":[{"url":"https://csp.withgoogle.com/csp/report-to/encsid_AXrpQdexiF0ssZ_nH8Dr-M3QgbdVRvO77RECMA"}]}"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: cross-origin-opener-policy-report-only: "same-origin; report-to="AXrpQdexiF0ssZ_nH8Dr-M3QgbdVRvO77RECMA""
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: p3p: "CP="This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en for more info.""
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: server: "ESF"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: x-xss-protection: "0"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: set-cookie: "GPS=1; Domain=.youtube.com; Expires=Wed, 01-Dec-2021 17:43:40 GMT; Path=/; Secure; HttpOnly"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: set-cookie: "YSC=UBlqJ4eUWlQ; Domain=.youtube.com; Path=/; Secure; HttpOnly; SameSite=none"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: set-cookie: "VISITOR_INFO1_LIVE=35SunwfNdNk; Domain=.youtube.com; Expires=Mon, 30-May-2022 17:13:40 GMT; Path=/; Secure; HttpOnly; SameSite=none"
2021-12-01 09:13:39.041 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: alt-svc: "h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43""
2021-12-01 09:13:39.042 6775-6858/com.example.app D/VLC: [e05d6950/1aca] libvlc stream: using access module "access"
2021-12-01 09:13:39.042 6775-6858/com.example.app D/VLC: [cb54c390/1aca] libvlc stream: looking for stream_filter module matching "prefetch,cache_block": 26 candidates
2021-12-01 09:13:39.042 6775-6858/com.example.app D/VLC: [cb54c390/1aca] libvlc stream: using 16777216 bytes buffer, 16777216 bytes read
2021-12-01 09:13:39.042 6775-6858/com.example.app D/VLC: [cb54c390/1aca] libvlc stream: using stream_filter module "prefetch"
2021-12-01 09:13:39.042 6775-6858/com.example.app D/VLC: [cb54c2f0/1aca] libvlc stream: looking for stream_filter module matching "any": 26 candidates
2021-12-01 09:13:39.044 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: in DATA (0x00) frame of 7953 bytes, flags 0x00, stream 1
2021-12-01 09:13:39.044 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: out (priority) WINDOW_UPDATE (0x08) frame of 4 bytes, flags 0x00, global
2021-12-01 09:13:39.046 6775-6858/com.example.app D/VLC: [cb54c2f0/1aca] libvlc stream: Trying Lua scripts in /data/user/0/com.example.app/app_vlc/.share/lua/playlist
2021-12-01 09:13:39.046 6775-6858/com.example.app D/VLC: [cb54c2f0/1aca] libvlc stream: Trying Lua scripts in /data/app/com.example.app-XeBxoe9GPTjeXYqmbgb0Xw==/lib/x86/vlc/lua/playlist
2021-12-01 09:13:39.046 6775-6858/com.example.app D/VLC: [cb54c2f0/1aca] libvlc stream: Trying Lua scripts in /system/usr/share/lua/playlist
2021-12-01 09:13:39.046 6775-6858/com.example.app D/VLC: [cb54c2f0/1aca] libvlc stream: no stream_filter modules matched
2021-12-01 09:13:39.046 6775-6858/com.example.app D/VLC: [cc219330/1aca] libvlc stream_directory: looking for stream_directory module matching "any": 1 candidates
2021-12-01 09:13:39.046 6775-6858/com.example.app D/VLC: [cc219330/1aca] libvlc stream_directory: no stream_directory modules matched
2021-12-01 09:13:39.046 6775-6858/com.example.app D/VLC: [e05d6810/1aca] libvlc input source: attachment of directory-extractor failed for https://www.youtube.com/watch?v=hwdjpbKG3h
2021-12-01 09:13:39.046 6775-6858/com.example.app D/VLC: [cb54c2f0/1aca] libvlc stream: looking for stream_filter module matching "record": 26 candidates
2021-12-01 09:13:39.046 6775-6858/com.example.app D/VLC: [cb54c2f0/1aca] libvlc stream: using stream_filter module "record"
2021-12-01 09:13:39.046 6775-6858/com.example.app D/VLC: [cb54c250/1aca] libvlc demux: looking for demux module matching "any": 49 candidates
2021-12-01 09:13:39.056 6775-6861/com.example.app D/VLC: [e05d6950/1acd] http stream: in DATA (0x00) frame of 16378 bytes, flags 0x00, stream 1
2021-12-01 09:13:39.057 6775-6858/com.example.app D/VLC: [ebbb69c0/1aca] libvlc xml reader: looking for xml reader module matching "any": 1 candidates
2021-12-01 09:13:39.057 6775-6858/com.example.app D/VLC: [ebbb69c0/1aca] libvlc xml reader: using xml reader module "xml"
2021-12-01 09:13:39.057 6775-6858/com.example.app D/VLC: [cb54c250/1aca] libvlc demux: subtitle demux discarded
2021-12-01 09:13:39.057 6775-6858/com.example.app D/VLC: [cb54c250/1aca] libvlc demux: TS module discarded (lost sync)
2021-12-01 09:13:39.057 6775-6858/com.example.app D/VLC: [cb54c250/1aca] libvlc demux: MOD validation failed (ext=)
2021-12-01 09:13:39.057 6775-6858/com.example.app D/VLC: [cb54c250/1aca] libvlc demux: trying url: https://www.youtube.com/watch?v=hwdjpbKG3h
2021-12-01 09:13:39.057 6775-6858/com.example.app D/VLC: [cb54c250/1aca] libvlc demux: CPU flags: 0x00000000
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [cb54c250/1aca] libvlc demux: couldn't guess format
2021-12-01 09:13:39.058 6775-6858/com.example.app W/VLC: [cb54c250/1aca] libvlc demux: this does not look like an MPEG PS stream, continuing anyway
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [cb54c250/1aca] libvlc demux: using demux module "ps"
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [ebb704f0/1aca] libvlc demux meta: looking for meta reader module matching "any": 2 candidates
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [ebb704f0/1aca] libvlc demux meta: Trying Lua scripts in /data/user/0/com.example.app/app_vlc/.share/lua/meta/reader
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [ebb704f0/1aca] libvlc demux meta: Trying Lua scripts in /data/app/com.example.app-XeBxoe9GPTjeXYqmbgb0Xw==/lib/x86/vlc/lua/meta/reader
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [ebb704f0/1aca] libvlc demux meta: Trying Lua scripts in /system/usr/share/lua/meta/reader
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [ebb704f0/1aca] libvlc demux meta: no meta reader modules matched
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [cc56dc30/1aca] libvlc input: `https://www.youtube.com/watch?v=hwdjpbKG3h' successfully opened
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [cb54c250/1aca] libvlc demux: removing module "ps"
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [cb54c2f0/1aca] libvlc stream: removing module "record"
2021-12-01 09:13:39.058 6775-6858/com.example.app D/VLC: [cb54c390/1aca] libvlc stream: removing module "prefetch"
2021-12-01 09:13:39.058 6775-6862/com.example.app D/VLC: [cb54c390/1ace] libvlc stream: end of stream
2021-12-01 09:13:39.059 6775-6858/com.example.app D/VLC: [e05d6950/1aca] libvlc stream: removing module "access"
2021-12-01 09:13:39.059 6775-6858/com.example.app E/VLC: [e05d6950/1aca] http stream: local stream 1 error: Cancellation (0x8)
2021-12-01 09:13:39.059 6775-6858/com.example.app D/VLC: [e05d6950/1aca] http stream: out RST_STREAM (0x03) frame of 4 bytes, flags 0x00, stream 1
2021-12-01 09:13:39.059 6775-6858/com.example.app D/VLC: [e05d6950/1aca] http stream: local shutdown
2021-12-01 09:13:39.059 6775-6858/com.example.app D/VLC: [e05d6950/1aca] http stream: out GOAWAY (0x07) frame of 8 bytes, flags 0x00, global
2021-12-01 09:13:39.064 6775-6864/com.example.app D/VLC: [e3a5f760/1ad0] libvlc meta fetcher: looking for meta fetcher module matching "any": 1 candidates
2021-12-01 09:13:39.064 6775-6864/com.example.app D/VLC: [e3a5f760/1ad0] libvlc meta fetcher: Trying Lua scripts in /data/user/0/com.example.app/app_vlc/.share/lua/meta/fetcher
2021-12-01 09:13:39.064 6775-6864/com.example.app D/VLC: [e3a5f760/1ad0] libvlc meta fetcher: Trying Lua scripts in /data/app/com.example.app-XeBxoe9GPTjeXYqmbgb0Xw==/lib/x86/vlc/lua/meta/fetcher
2021-12-01 09:13:39.064 6775-6864/com.example.app D/VLC: [e3a5f760/1ad0] libvlc meta fetcher: Trying Lua scripts in /system/usr/share/lua/meta/fetcher
2021-12-01 09:13:39.064 6775-6864/com.example.app D/VLC: [e3a5f760/1ad0] libvlc meta fetcher: no meta fetcher modules matched
2021-12-01 09:13:39.064 6775-6864/com.example.app D/VLC: [e3a5f760/1ad0] libvlc art finder: looking for art finder module matching "any": 2 candidates
2021-12-01 09:13:39.064 6775-6864/com.example.app D/VLC: [e3a5f760/1ad0] libvlc art finder: Trying Lua scripts in /data/user/0/com.example.app/app_vlc/.share/lua/meta/art
2021-12-01 09:13:39.064 6775-6864/com.example.app D/VLC: [e3a5f760/1ad0] libvlc art finder: Trying Lua scripts in /data/app/com.example.app-XeBxoe9GPTjeXYqmbgb0Xw==/lib/x86/vlc/lua/meta/art
2021-12-01 09:13:39.064 6775-6864/com.example.app D/VLC: [e3a5f760/1ad0] libvlc art finder: Trying Lua scripts in /system/usr/share/lua/meta/art
2021-12-01 09:13:39.064 6775-6864/com.example.app D/VLC: [e3a5f760/1ad0] libvlc art finder: no art finder modules matched
2021-12-01 09:13:39.066 6775-6775/com.example.app D/youtubeVal: 0
What am I missing or doing incorrectly?