private void loadImage(int index) { Log.d(TAG, "load image:" + index); if (index < video.getImages().length && index >= 0) { File img = video.getImages()[index]; Bitmap bmp = BitmapFactory.decodeFile(img.getAbsolutePath(), this.bmpOptions); if (bmp != null) { synchronized (bmpQ) { bmpQ.offer(bmp); } } } }
private void playAudio() { if (this.prepareAudio()) { int position = index * (int) (1000 / video.getFps()); this.audioPlayer.seekTo(position); this.audioPlayer.start(); } }
private void initPlayer() { TimerTask imageLoadTask = new ImageLoadTask(); TimerTask playTask = new PlayTask(); this.playTimer = new Timer("Video player", true); this.playTimer.schedule(imageLoadTask, 0, 1); this.playTimer.scheduleAtFixedRate(playTask, 0, (long) (1000 / video.getFps())); }