Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public class Example extends Activity {
  2. VideoView vv;
  3. /** Called when the activity is first created. */
  4. @Override
  5. public void onCreate(Bundle savedInstanceState) {
  6. super.onCreate(savedInstanceState);
  7. setContentView(R.layout.main);
  8.  
  9. vv = (VideoView)findViewById(R.id.VideoView01);
  10.  
  11. //Video Loop
  12. vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
  13. public void onCompletion(MediaPlayer mp) {
  14. vv.start(); //need to make transition seamless.
  15. }
  16. });
  17.  
  18. Uri uri = Uri.parse("android.resource://com.example/"
  19. + R.raw.video);
  20.  
  21. vv.setVideoURI(uri);
  22. vv.requestFocus();
  23. vv.start();
  24. }
  25. }
  26.  
  27. videoView.setOnPreparedListener(new OnPreparedListener() {
  28. @Override
  29. public void onPrepared(MediaPlayer mp) {
  30. mp.setLooping(true);
  31. }
  32. });
  33.  
  34. MediaPlayer.setLooping(true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement