Android 在棒棒糖上播放URL中的视频

Android 在棒棒糖上播放URL中的视频,android,video,android-5.0-lollipop,Android,Video,Android 5.0 Lollipop,我正试图从这样的URL打开一个.mp4视频 Intent intent = new Intent(Intent.ACTION_VIEW); Uri data = Uri.parse("https://yaddayadda/video.mp4"); intent.setDataAndType(data, "video/*"); if (intent.resolveActivity(context.getPackageManager()) != null) {

我正试图从这样的URL打开一个.mp4视频

    Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri data = Uri.parse("https://yaddayadda/video.mp4");
    intent.setDataAndType(data, "video/*");


    if (intent.resolveActivity(context.getPackageManager()) != null) {
        context.startActivity(intent);
    }
当我尝试使用谷歌照片应用程序(在Nexus上,这是唯一的选项)打开视频时,这对棒棒糖不起作用。在Kitkat和其他版本中,这些照片有效,但在棒棒糖上无效


有人知道如何使用照片应用程序在棒棒糖上播放视频吗?

要从链接查看活动中的视频,请使用以下代码:

// Declare variables
ProgressDialog pDialog;
VideoView videoview;

// Insert your Video URL
String VideoURL = "http://<video-url>";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Get the layout from video_main.xml
    setContentView(R.layout.videoview_main);
    // Find your VideoView in your video_main.xml layout
    videoview = (VideoView) findViewById(R.id.VideoView);
    // Execute StreamVideo AsyncTask

    // Create a progressbar
    pDialog = new ProgressDialog(VideoViewActivity.this);
    // Set progressbar title
    pDialog.setTitle("Video");
    // Set progressbar message
    pDialog.setMessage("Buffering...");
    pDialog.setIndeterminate(false);
    pDialog.setCancelable(false);
    // Show progressbar
    pDialog.show();

    try {
        // Start the MediaController
        MediaController mediacontroller = new MediaController(
                VideoViewActivity.this);
        mediacontroller.setAnchorView(videoview);
        // Get the URL from String VideoURL
        Uri video = Uri.parse(VideoURL);
        videoview.setMediaController(mediacontroller);
        videoview.setVideoURI(video);

    } catch (Exception e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
    }

    videoview.requestFocus();
    videoview.setOnPreparedListener(new OnPreparedListener() {
        // Close the progress bar and play the video
        public void onPrepared(MediaPlayer mp) {
            pDialog.dismiss();
            videoview.start();
        }
    });

}

}

请解释“不工作”的含义。谷歌照片应用程序打开,有消息说我不能播放该视频。这只发生在棒棒糖上,在Kitkat上,视频播放。然后,除了尝试
video/mp4
而不是
video/*
之外,你对此无能为力。
public class MainActivity extends Activity implements OnClickListener {

private Button btn;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    btn = (Button) findViewById(R.id.button1);
    btn.setOnClickListener(this);
}

@Override
public void onClick(View v) {
    if (v.getId() == R.id.button1) {
        Intent intent = new Intent(Intent.ACTION_VIEW);

        intent.setDataAndType(Uri.parse("http://ur URL"), "video/*");

        startActivity(Intent.createChooser(intent, "Complete action using"));
    }

}