在VideoView在Android中播放视频

编程入门 行业动态 更新时间:2024-10-10 05:17:41
本文介绍了在VideoView在Android中播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想不通为什么我不能在我的VideoView播放视频。所有我得到的消息是无法播放视频:很抱歉,此视频无法播放。

I can't figure out why am i not able to play the video in my VideoView. All i'm getting a message is Cannot Play Video : Sorry, this video cannot be played.

我创建了一个SD卡为我的模拟器为好。我需要把我的SD卡在我的SDK中的特定文件夹?请发表评论。

I created an SD card for my emulator as well. Do i need to place me SD card in a particular folder in my SDK? Please comment.

下面的布局:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/LinearLayout01" android:layout_height="fill_parent" android:paddingLeft="2px" android:paddingRight="2px" xmlns:android="schemas.android/apk/res/android" android:paddingTop="2px" android:paddingBottom="2px" android:layout_width="fill_parent" android:orientation="vertical"> <VideoView android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/VideoView" /> </LinearLayout>

下面是code:

package com.examples.videoviewdemo; import android.app.Activity; import android.os.Bundle; import android.widget.MediaController; import android.widget.VideoView; public class VideoViewDemo extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); VideoView videoView = (VideoView)findViewById(R.id.VideoView); //MediaController mediaController = new MediaController(this); // mediaController.setAnchorView(videoView); //videoView.setMediaController(mediaController); videoView.setVideoPath("/sdcard/blonde_secretary.3gp"); videoView.start(); } }

等待答复...

Waiting for the reply...

推荐答案

我的猜测是,你的影片是与Android兼容。尝试用不同的视频。 这其中绝对和。如果该影视作品,和你没有,那么你的视频不与Android兼容。

My guess is that your video is incompatible with Android. Try it with a different video. This one definitely works used to work with Android (but does not on newer devices, for some reason). If that video works, and yours does not, then your video is not compatible with Android.

正如其他人所指出的,请在设备上进行测试。在模拟器上视频播放需要太多电能。

As others have indicated, please test this on a device. Video playback on the emulator requires too much power.

更多推荐

在VideoView在Android中播放视频

本文发布于:2023-11-27 18:50:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639190.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视频   VideoView   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!