2

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 progress 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 ?

4

2 回答 2

-1

我不确定 YouTube 如何制作他们的菜单,但您可以尝试使用SlidingDrawer并将您的嵌套ProgressBar在其中。

于 2011-03-09T13:17:53.853 回答
-2

看看这段代码,这可能会对你有所帮助。
此代码还包括必要的注释,如果需要的话。

  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();

      }

   }

谢谢...

于 2011-03-09T13:29:52.497 回答