Get the thumbnail of a video asynchronously

@param videoPath     the path to the video
@param cb            the callback
960314
public static void getVideoThumbnail(String videoPath, final VideoThumbnailCallback cb){
        new AsyncTask<String, Void, Bitmap>(){
            @Override
            protected Bitmap doInBackground(String... params) {
                if(params.length > 0) {
                    String path = params[0];
                    if(!TextUtils.isEmpty(path)){
                        return getVideoThumbnail(path);
                    }
                }
                return null;
            }

            @Override
            protected void onPostExecute(Bitmap bitmap) {
                cb.onThumbnail(bitmap);
            }
        }.execute(videoPath);
    }
93921
def saveThumbnail(self,fileName,filePath):
        
        if self._thumbnail is None:
            self.__init()
        param_dict = {}
        if  self._thumbnail is not None:
            imgUrl = self.root + "/info/" + self._thumbnail
            onlineFileName, file_ext = splitext(self._thumbnail)
            fileNameSafe = "".join(x for x in fileName if x.isalnum()) + file_ext
            result = self._get(url=imgUrl,
                               param_dict=param_dict,
                               securityHandler=self._securityHandler,
                               proxy_url=self._proxy_url,
                               proxy_port=self._proxy_port,
                               out_folder=filePath,
                               file_name=fileNameSafe)
            return result
        else:
            return None
1011500
private static void returnBitmapInto(final Bitmap bitmap, final String path, final Object into) {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                if (into != null && path != null && bitmap != null) {
                    if (into instanceof ImageView) {
                        Log.d(TAG, "return bitmap " + path + " into ImageView");
                        ((ImageView) into).setImageBitmap(bitmap);
                    } else if (into instanceof Callback) {
                        Log.d(TAG, "return bitmap " + path + " into Callback");
                        ((Callback) into).onBitmapLoaded(path, bitmap);
                    }
                }
            }
        });
    }
485889
public EmbedBuilder setThumbnail(InputStream thumbnail, String fileType) {
        delegate.setThumbnail(thumbnail, fileType);
        return this;
    }
484419
def thumbnail(self, path, height, width, quality=100, **kwargs):
        
        params = {'ec': 1,
                  'path': path,
                  'quality': quality,
                  'width': width,
                  'height': height}

        url = 'http://{0}/rest/2.0/pcs/thumbnail'.format(BAIDUPCS_SERVER)
        return self._request('thumbnail', 'generate', url=url, extra_params=params, **kwargs)
850359
public void getChildren(String path, boolean watch, ChildrenCallback cb,
            Object ctx) {
        verbotenThreadCheck();
        getChildren(path, watch ? watchManager.defaultWatcher : null, cb, ctx);
    }
1012346
def get_video(self, node):
        
        video = Video()
        video.embed_code = self.get_embed_code(node)
        video.embed_type = self.get_embed_type(node)
        video.width = self.get_width(node)
        video.height = self.get_height(node)
        video.src = self.get_src(node)
        video.provider = self.get_provider(video.src)
        return video
1215771
function (classpath, cb) {
            var logicalPath = Aria.getLogicalPath(classpath, ".tpl", true);
            this.loadFile(logicalPath, {
                fn : this._onTplFileContentReceive,
                scope : this,
                args : {
                    origCb : cb
                }
            }, null);
        }
1227465
public static Bitmap load(String path) {
        try {
            File fi = new File(path);
            if (fi.isDirectory() || !fi.exists()) {
                return null;
            }

            return load(new FileInputStream(path), -1, -1);
        } catch (Exception e) {
            Log.e(TAG, "", e);
            return null;
        }
    }
793063
private InputStream getTintTransformationResourceStream(int id, TypedValue value, int color) {
		Bitmap bitmap = getBitmapFromResource(id, value);
		bitmap = BitmapUtils.processTintTransformationMap(bitmap, color);
		return getStreamFromBitmap(bitmap);
	}
297274
protected final Image getImage(String imagePath) {
		final ImageDescriptor descriptor = getImageDescriptor(imagePath);
		if (descriptor == null) {
			return null;
		}
		return descriptor.createImage();
	}
162053
def get_thumbnail(self, video_path, at_time=0.5):
        
        filename = os.path.basename(video_path)
        filename, __ = os.path.splitext(filename)
        _, image_path = tempfile.mkstemp(suffix='_{}.jpg'.format(filename))

        video_duration = self.get_media_info(video_path)['duration']
        if at_time > video_duration:
            raise exceptions.InvalidTimeError()
        thumbnail_time = at_time

        cmds = [self.ffmpeg_path, '-i', video_path, '-vframes', '1']
        cmds.extend(['-ss', str(thumbnail_time), '-y', image_path])

        process = self._spawn(cmds)
        self._check_returncode(process)

        if not os.path.getsize(image_path):
            # we somehow failed to generate thumbnail
            os.unlink(image_path)
            raise exceptions.InvalidTimeError()

        return image_path
1009003
public function extractImageFromVideo($filePath, $timeFrame = 1)
    {
        $pathInfo = pathinfo($filePath);
        $extractedImagePath = $pathInfo['dirname'] . DIRECTORY_SEPARATOR
            . time() . $pathInfo['basename'] . '-' . $timeFrame . '.jpg';

        $video = $this->ffmpeg->open($filePath);
        $video->frame(TimeCode::fromSeconds($timeFrame))->save($extractedImagePath);

        return $extractedImagePath;
    }
77519
public T withThumbnail(Path path, String name, double scale) {
       return withThumbnail(path.toString(),name,scale);
    }
96743
def attach_video(self, video: typing.Union[InputMediaVideo, base.InputFile],
                     thumb: typing.Union[base.InputFile, base.String] = None,
                     caption: base.String = None,
                     width: base.Integer = None, height: base.Integer = None, duration: base.Integer = None):
        
        if not isinstance(video, InputMedia):
            video = InputMediaVideo(media=video, thumb=thumb, caption=caption,
                                    width=width, height=height, duration=duration)
        self.attach(video)
1117164
@WorkerThread
    @Nullable
    public String createThumbnailForImage(String imagePath) {
        if (TextUtils.isEmpty(imagePath)) return null;

        File inFile = new File(imagePath);
        if (!inFile.exists()) return null;

        File thumbnailFile = randomPath(imagePath);
        if (thumbnailFile.exists()) return thumbnailFile.getAbsolutePath();

        Bitmap inBitmap = readImageFromPath(imagePath, THUMBNAIL_SIZE, THUMBNAIL_SIZE);
        if (inBitmap == null) return null;

        ByteArrayOutputStream compressStream = new ByteArrayOutputStream();
        inBitmap.compress(Bitmap.CompressFormat.JPEG, THUMBNAIL_QUALITY, compressStream);

        try {
            compressStream.close();
            thumbnailFile.createNewFile();

            FileOutputStream writeStream = new FileOutputStream(thumbnailFile);
            writeStream.write(compressStream.toByteArray());
            writeStream.flush();
            writeStream.close();
            return thumbnailFile.getAbsolutePath();
        } catch (Exception ignored) {
            return null;
        }
    }
953378
def from_video(self, path):
        
        frames = self.get_video_frames(path)
        self.handle_type(frames)
        return self