Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not able to play mkv file #18

Closed
pateljigar7210 opened this issue Mar 16, 2020 · 3 comments
Closed

not able to play mkv file #18

pateljigar7210 opened this issue Mar 16, 2020 · 3 comments

Comments

@pateljigar7210
Copy link

No description provided.

@Inside4ndroid
Copy link

I have this issue when trying to play mkv files....

here is the erro log >

2020-07-08 15:17:07.448 22820-23082/com.app.strix E/ExoPlayerImplInternal: Source error com.google.android.exoplayer2.ParserException: org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT @1:385 in java.io.InputStreamReader@dadf4b5) at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parse(DashManifestParser.java:96) at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parse(DashManifestParser.java:61) at com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:172) at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:391) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) Caused by: org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT @1:385 in java.io.InputStreamReader@dadf4b5) at org.kxml2.io.KXmlParser.readEntity(KXmlParser.java:1220) at org.kxml2.io.KXmlParser.readValue(KXmlParser.java:1402) at org.kxml2.io.KXmlParser.next(KXmlParser.java:393) at org.kxml2.io.KXmlParser.next(KXmlParser.java:313) at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parse(DashManifestParser.java:89) at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parse(DashManifestParser.java:61)  at com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:172)  at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:391)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)  at java.lang.Thread.run(Thread.java:764) 

@Inside4ndroid
Copy link

Whoops i fixed it lol...

for those who would like to know how

first add this line to PublicValues.java in the utils folder >

public static final String KEY_MKV = "mkv";

now in the AndExoPlayerView add this the the MediaSource buildMediaSource method >

else if (validUrl && uri.getLastPathSegment().contains(PublicValues.KEY_MKV)) {

            DefaultHttpDataSourceFactory sourceFactory = new DefaultHttpDataSourceFactory(PublicValues.KEY_USER_AGENT);
            if (extraHeaders != null) {
                for (Map.Entry<String, String> entry : extraHeaders.entrySet())
                    sourceFactory.getDefaultRequestProperties().set(entry.getKey(), entry.getValue());
            }

            return new ProgressiveMediaSource.Factory(sourceFactory)
                    .createMediaSource(uri);

        } else if (!validUrl && uri.getLastPathSegment().contains(PublicValues.KEY_MKV)) {
            return new ProgressiveMediaSource.Factory(new DefaultDataSourceFactory(context, PublicValues.KEY_USER_AGENT))
                    .createMediaSource(uri);

        }

now when you pass an mkv url as source it will play without any issues :)

Happy coding :)

@HamidrezaAmz
Copy link
Owner

Hey @pateljigar7210
New version of MagicalExoPlayer released, now player support .mkv files, Just update ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants