Vimeo video stops playing on Android 6 devices
Asked Answered
D

2

18

I'm trying to play video's from Vimeo in my app. The problem is that on Android 6 devices the video stops playing after a certain time. On devices with a lower API everything plays fine.

  • The time depends on the quality. For the video of the provided url's below plays a certain minutes (1 to 3). How lower the video quality how longer it keeps playing.
  • After 1 to 3 minutes the mediaplayer throws an ProtocolException. The app does not crash on this but the video freezes when the buffered video piece is played. [MediaHTTPConnection] readAt 25182208 / 32768 => java.net.ProtocolException: unexpected end of stream and shows this in de log
  • After the exception the video plays 30 seconds (buffered), then the application outputs this [MediaPlayer] error (1, -1004)

We're emailing for weeks now with Vimeo Support but they can't provide a solution or a possible cause. Now after weeks of mailing the support desk says that they're not supporting Android, but we've tried their suggestions:

  • Use the redirected and unredirected url's

http://player.vimeo.com/external/185069251.hd.mp4?s=fd7b4178a59166b3f636f2e48f1d49b99db66ed2&profile_id=174 [Redirected URL]

https://fpdl.vimeocdn.com/vimeo-prod-skyfire-std-us/01/2013/7/185069251/610514667.mp4?token=586a9287_0xbb25f73405c612b30e0c64dc4c3a169e30137f84 [Not redirected URL]

  • Use a video view instead of a mediaplayer

  • We've tried a native Android and a Xamarin Android implementation

  • Try to download the file => this works but we want to stream because some video's are longer then 30 minutes (>100mb). Uncomment the code in the onCreate in the DownLoadActivity to test downloading.

In the browser everything works fine.

I've placed a testproject on We-Transfer where you can see the problem https://bazookas.wetransfer.com/downloads/40dadcc8a01f7ebf025345cdf88b731220170102160508/21970a

Defile answered 2/1, 2017 at 16:10 Comment(3)
did you find a solution?Decidua
@Decidua We've used the Android ExoPlayer. This player worked fine. developer.android.com/guide/topics/media/exoplayer.htmlDefile
I did the same. I had to fix this issue in old app. I could fix it with the answer i posted below, but easier solution was just rewrite video player module.Decidua
G
3

HI in my app I'm also using Vimeo but in another way. And it' working fine without issue in any OS. (For Native Android)

 webView.setWebViewClient(new WebViewClient() {
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                Log.i("", "Processing webview url click...");
                view.loadUrl(url);
                return true;
            }

            public void onPageFinished(WebView view, String url) {
                Log.i("", "Finished loading URL: " + url);
                Const.disMisProgressdialog();
            }


            @Override
            public void onLoadResource(WebView view, String url) {
                super.onLoadResource(view, url);
            }
        });

        if(windowwidth < 480) {
            webView.loadUrl("https://player.vimeo.com/video/<YOUR VEMIO ID>?player_id=player&autoplay=1&title=0&byline=0&portrait=0&api=1&maxheight=320&maxwidth=480");
        }else{
            webView.loadUrl("https://player.vimeo.com/video/<YOUR VEMIO ID>?player_id=player&autoplay=1&title=0&byline=0&portrait=0&api=1&maxheight=480&maxwidth=800");
        }

for

windowwidth :-
int windowwidth = getWindowManager().getDefaultDisplay().getWidth();
int windowheight = getWindowManager().getDefaultDisplay().getHeight();

Globefish answered 9/1, 2017 at 10:42 Comment(1)
I have a own mediacontroller with a specific layout and functionality that can be commanded from the core (business layer) of my application. Maybe a webview based solution works, but it is not an option for me or my client. I need a mediaplayer based solution. Nevertheless thank you for the effort.Defile
D
2

Looks like the issue with the url you use. You use url from vimeo api for HD file. And for some reason android system don't allow to cache more then some amount of KB.

If you change the url from HD to vimeoHLS - link for streaming, everything works fine. It fixed the issue for my 7 android, but i haven't tested this for another version yet tho.

Can't find a reason why this doesn't work on Android 6+, but works fine for lower versions.

Decidua answered 29/6, 2017 at 14:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.