Slide 11
Slide 11 text
ᶅ࡞ͨ͠ϥΠϒϥϦ
&YP1MBZFS'JMUFSͷ͍ํᶃ
4JNQMF&YP1MBZFSΛ࡞Δ
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
// Measures bandwidth during playback. Can be null if not required.
DefaultBandwidthMeter defaultBandwidthMeter = new DefaultBandwidthMeter();
// Produces DataSource instances through which media data is loaded.
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, Util.getUserAgent(context,
"yourApplicationName"), defaultBandwidthMeter);
// Produces Extractor instances for parsing the media data.
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
// This is the MediaSource representing the media to be played.
MediaSource videoSource = new ExtractorMediaSource(Uri.parse(MP4_URL), dataSourceFactory, extractorsFactory, null,
null);
// SimpleExoPlayer
player = ExoPlayerFactory.newSimpleInstance(context, trackSelector);
// Prepare the player with the source.
player.prepare(videoSource);
player.setPlayWhenReady(true);