Does anyone know how I can play a local .mp4 file from androids Resource folder or Asset? I've read nearly everything I can find online but can't get anything to work. As far as I've read, it's not possible to read the video file from the Assets folder.
I've read this:
https://medium.com/@tonyowen/playing-local-r-raw-files-with-exoplayer2-1a62276ebeaa
However, it still doesn't work for me. One of the reasons I can't see Datasource.Factory
at all. Therefore the code can't be completed. Even if I disregard this part of the code, the player with throw an error.
Secondly, I've tried doing is:
string uri = "android.resource://" + _context.PackageName + "/" + Resource.Raw.BlankVideo;
System.Diagnostics.Debug.WriteLine(uri);
_exoPlayer = ExoPlayerFactory.NewSimpleInstance(_context, new DefaultTrackSelector(), new DefaultLoadControl());
_mainHandler = new Handler();
_dataSourceFactory = new DefaultDataSourceFactory(_context, Util.GetUserAgent(_context, "SHLSP"), _bandwidthMeter);
_mediaSource = new ExtractorMediaSource(Android.Net.Uri.Parse(uri), _dataSourceFactory, new DefaultExtractorsFactory(), _mainHandler, null);
_exoPlayerView.Player.Prepare(_mediaSource);
_exoPlayerView.Player.PlayWhenReady = true;
However, I get the error saying that that com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: Unable to connect to android.resource://com.services.shlsp/2131034112
So I'm not sure if and where I'm going wrong or is this the end?