Search code examples
androidstreamingexoplayermpeg-dash

Exoplayer 2.9.4 SmoothStreaming


I'm using explayer 2.9.4, and I have no idea how to create smooth-streaming with Exoplayer. I'm searching over internet with days but nothing found. My code is this, but this is for normal streaming I need with DASH

    TrackSelector trackSelector = new DefaultTrackSelector();
    exoPlayer = ExoPlayerFactory.newSimpleInstance(this, trackSelector);
    Uri videoURI = Uri.parse(videoURL);
    DefaultHttpDataSourceFactory dataSourceFactory = new DefaultHttpDataSourceFactory( Util.getUserAgent(this, "My Streamer"));
    mediaSource = new ExtractorMediaSource.Factory(dataSourceFactory) .createMediaSource(videoURI);

and is working tried some code from stackoverflow like this:

     DefaultHttpDataSourceFactory dataSourceFactory = new DefaultHttpDataSourceFactory( Util.getUserAgent(this, "FTV Stream Albania"));
        dashMediaSource = new DashMediaSource(videoURI, dataSourceFactory, new DefaultDashChunkSource.Factory(dataSourceFactory), null, null);
        BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        TrackSelector trackSelector = new DefaultTrackSelector(new AdaptiveTrackSelection.Factory(bandwidthMeter));

but I get error :

ExoPlayerImplInternal: Source error.

com.google.android.exoplayer2.ParserException: org.xmlpull.v1.XmlPullParserException: Unexpected token (position:TEXT G@��B�%���������...@2:79 in java.io.InputStreamReader@c587547) at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parse(DashManifestParser.java:105) at........

Documentation is very poor. Any help will be appreciated.


Solution

  • Sulution was I added two files from ExoPlayer Github Soruce codes:

    DownloadTracker.java and DemoDownloadService.java and then from PlayerActivity.java just got codes I need, now it works great.