Closed Zintom closed 1 year ago
Here is an Example
var Exoplayer = new IExoPlayer.Builder(MainContext).SetMediaSourceFactory(MainDataSource).Build();
MediaItem mediaItem = MediaItem.FromUri(Android.Net.Uri.Parse("https://wowonder.fra1.cdn.digitaloceanspaces.com/upload/videos/2022/11/PRjaipBn2Gmj4CEV1O4e_11_a509a30225863eb0c2e5cf08e343a826_video_720p_converted.mp4"));
HttpDataSourceFactory = new DefaultHttpDataSource.Factory().SetAllowCrossProtocolRedirects(true);
if (PlayerSettings.EnableOfflineMode) // Custom Function by us
{
Cache = MainApplication.GetInstance().ExoCache;
CacheFactoryDataSource = new CacheDataSource.Factory();
CacheFactoryDataSource.SetCache(Cache).SetUpstreamDataSourceFactory(HttpDataSourceFactory).SetFlags(CacheDataSource.FlagIgnoreCacheOnError).SetEventListener(new CachEventListner());
}
MediaItem mediaItem = MediaItem.FromUri(Android.Net.Uri.Parse(trackurl));
Exoplayer.AddMediaItem(mediaItem);
Exoplayer.Prepare();
Exoplayer.Play();
@ScriptSun Thanks for the example.
How are you defining MainDataSource
?
Using a DefaultMediaSourceFactory
with a DefaultHttpDataSource
fails with the following error:
"Failed resolution of: Lcom/google/common/base/Supplier;"
@Zintom Include Guava in your project or revert to 2.18.3, it seems a new version was pushed from my fork in which I was tinkering as to why Guava wasn't working in someone else's issue.
@ArchangelWTF Cheers for that. Will this be fixed in a future official release?
Yeah I've already made a PR just now that reverts the change just need it to be merged in.
The sample documentation uses the
SimpleExoPlayer
class which has now been deprecated. The suggestion is to use theIExoPlayer
interface.I am trying to work out how to instantiate an
IExoPlayer
but am having no luck as the constructors I wish to use are only available on API 33 and above and the constructors which aren't are marked asobsolete
.Please could some guidance be provided on how to create an
IExoPlayer
in this latest release.