开发者

progress bar on videoview android

HI i am developing video streaming application and i need to make a progress bar on my application (not a progress dialog) i tried implementing it i put it on the xml file and set it to invisible on the onprepared method but the problem is that the progress bar is placed on top of the video which makes the video size small i need to make the video fill parent and the progress bar also like the youtube application how can i do that ?

also i'm online streaming so how can i display the buffering percentage when the video is stopped for delay

another point is i want the progres开发者_运维百科s bar to disappear when the alert of this video canot be played now ,, but i don't know where in the code i should disappear the progress bar ? when this alert appears ?


I'm not sure how YouTube does their menu, but you could try a SlidingDrawer and nest your ProgressBar in that.


look at this code, this might help you.
This code also include necessary comments , where ever needed.

  public void videoPlayer(String path, String fileName, boolean autoplay){

      //get current window information, and set format, set it up differently, if you need some special effects

      getWindow().setFormat(PixelFormat.TRANSLUCENT);

      //the VideoView will hold the video

      VideoView videoHolder = new VideoView(this);

      //MediaController is the ui control howering above the video (just like in the default youtube player).

      videoHolder.setMediaController(new MediaController(this));

      //assing a video file to the video holder

      videoHolder.setVideoURI(Uri.parse(path+"/"+fileName));

      //get focus, before playing the video.

      videoHolder.requestFocus();

      if(autoplay){

          videoHolder.start();

      }

   }

Thanks...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜