简体   繁体   中英

Exo player hangs and crashes when played with URL

Sometimes Exo player hangs and crashes happen in my app. I think I used a live URL in the player so there is some time-out issue.

 Uri assetSrtUri = Uri.parse(vvtFilePath);
            MediaItem.SubtitleConfiguration subtitle = new MediaItem.SubtitleConfiguration.Builder(assetSrtUri)
                    .setMimeType(MimeTypes.TEXT_VTT)
                    .setLanguage("en")
                    .setSelectionFlags(C.SELECTION_FLAG_DEFAULT)
                    .build();
    
            MediaItem mediaItem = new MediaItem.Builder()
                    .setUri(uri)
                    .setSubtitleConfigurations(ImmutableList.of(subtitle))
                    .build();
    
            player.setMediaItem(mediaItem);
            player.prepare();

在此处输入图像描述

The error showing here is indeed a socket read timeout - to verify there is not other underlying issues you could test in the demo explorer by adding your url (and any DRM license URL) to the test json data file there.

You could also test on a local network if you have the same source available locally, or a similar source.

It is possible the video server is the bottle neck also - ie the network is ok but the video server is overworked or has some fault. If you have access to the video server then checking the logs would likely be the best place to start.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM