1

I use the native android sdk way to get online video thumbnail,Source code is as follows:

private Bitmap showVideoThumbnail(Boolean isUrlPath, String videoPath)
{
    Bitmap bitmap = null;
    MediaMetadataRetriever mmRetriever = null;
    try
    {
        if (StringUtil.isEmpty(videoPath))
        {
            return null;
        }

        mmRetriever = new MediaMetadataRetriever();
        if (isUrlPath)
        {
            mmRetriever.setDataSource(videoPath, new HashMap<String, String>());
        } else
        {
            mmRetriever.setDataSource(videoPath);
        }

        bitmap = mmRetriever.getFrameAtTime(1000, MediaMetadataRetriever.OPTION_CLOSEST);

    } catch (Exception e)
    {
        e.printStackTrace();
    } finally
    {
        if (mmRetriever != null)
        {
            mmRetriever.release();
            mmRetriever = null;
        }
    }
    return bitmap;
}

However, in some android device, this method can not get iPhone device captured video thumbnail. so,i want to what is the problem,please,thank you

4

0 回答 0