0

I want to play video in my application, but now am confused in different approach to play video in android. Android itself has a feature "VideoView". Shall I implement this videoView or use an Intent.action_view to open the video in the existing player.

I want to know the best approach to follow and the pros and cons of videoView ?

Please guide me!!

Kanika
  • 10,648
  • 18
  • 61
  • 81

3 Answers3

1

Well the best practice, generally, is to use Intent system as much as you can to avoid additional overhead required to implement them yourself when there could, possibly, be better alternatives and to provide users with additional choice. But there might be cases when there is no application available for the required action and hence you'll be needing to implement the task yourself.

My advice is use the intent system, and if no apps were found in user's handset for video playback then you can use VideoView in that case.

d3m0li5h3r
  • 1,957
  • 17
  • 33
1

No one can tell with out your purpose

1) Based on your requirement you have to choose which one is suitable

2) If you want's to open current video in your own application , you have to use Video view and to Implement controls for Video view , you should use MediaController class

actually this is like createing small video view with minimal options .

3) instead of creating Custom video view you can play selected video using Action.View , but that some of Video player should have in your device .here your opeing in your video in other application , depends on that application you can show more options for video accessing .

sravan
  • 5,303
  • 1
  • 31
  • 33
1

Well, there is no right or wrong way here. It really depends on what you want to do. If the user of your app should only be able to watch the video and your app doesn't need to interact in any way during the playback or needs any information about whether or how the user watched the video, then an intent would probably suffice. And it's less work.

If you want to provide any additional features during the playback a VideoView would be better (and it's really not that much work to implement a simple videoview). Also with an intent you don't know what app the user will choose to open the video, so you have no guarantee how the user will experience your video... If you implement your own video view you have full control, how it works and how it looks.

So if it's not the core functionality and you only want to show a video once or so, an intent is probably a good way. If it's an important part of your app and you might want to add features and if it would be a bad experience for the user if s/he chose a bad video player, I would definitely recommend doing the little extra work and impl your own video viewer activity...

jpm
  • 3,300
  • 1
  • 19
  • 29