0
Intent i = new Intent(Intent.ACTION_VIEW);
Uri uriforintent = Uri.parse(uri);
i.setDataAndType(uriforintent, "video/*");
//startActivity(i);
startActivityForResult(i, 0);

The video is a local file playable by Samsung stock vid player if I call startActivity(). It only fails to play with startActivityForResult().

Following errors were logged:

06-02 19:07:12.742: E/MediaPlayer(23993): Error (1,-2147483648)
06-02 19:07:12.742: E/MoviePlaybackService(23993): TouchPlayer :: mErrorListener = 1<<<<<<<<<<<<
06-02 19:07:12.742: D/MoviePlayer(23993): onSvcNotification - action : 104
06-02 19:07:12.742: E/MoviePlayer(23993): createErrorDialog(action, intent). action = 104

Does anyone faces the same issue with Samsung stock video player?

1 Answers1

0

Since ACTION_VIEW is not designed for use with startActivityForResult(), and since you will not actually get a result anyway, just use startActivity().

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • follow up question. what do you suggest me to do if I need to do something after the video is stopped? Must I implement my own player? – alexhkleung Jun 05 '14 at 11:25
  • @alexhkleung: Yes, you must implement your own player, whether using `VideoView` or the combination of `MediaPlayer` and a surface (`TextureView`, or `SurfaceView` if you need to support older devices). – CommonsWare Jun 05 '14 at 11:33
  • 1
    @alexhkleung : "Must I implement my own player?". Yes, that's basically your only option. If you use any 3rd-party app to do anything there is no guarantee you'll ever know when it has completed. If your video file format is supported by `MediaPlayer` then I'd suggest you look into implementing a player with that. You can at least get notifications of 'completion' of playback (for example). You can also youse various methods to tell if a user has paused / stopped playback etc. – Squonk Jun 05 '14 at 11:39