简体   繁体   English

我正在使用C#和Mono并尝试从我的android播放简单的视频文件,但确实有用

[英]I'm using c# and mono and trying to play simple video file from my android but it dosent work

using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Media;

namespace MoviePlayer
{
    [Activity(Label = "MoviePlayer", MainLauncher = true, Icon = "@drawable/icon")]
    public class Activity1 : Activity
    {
        int count = 1;
        MediaPlayer mp;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            mp = new MediaPlayer();
            mp.Prepare();
            mp.SetDataSource()
            mp.Start();

        }
    }
}

I don't know what should be in the mp.SetDataSource() I looked on examples but didn't understand. 我不知道在看示例但不理解的mp.SetDataSource()中应该包含什么。

You need to pass a path to the file you want to play as a string to the SetDataSource() method to play that file. 您需要将要播放的文件的路径作为string传递给SetDataSource()方法以播放该文件。

Mono Documentation 单声道文档

Android Documentation Android文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在尝试填写我的清单 <Class> 从文本文件使用C#? - I'm trying to fill my List<Class> from a text file using C#? 我正在尝试从C#中的自定义文件类型读取 - I'm trying to read from a custom file type in C# 从javascript dosent work调用ac#函数 - calling a c# function from javascript dosent work 我正在尝试让我的记忆功能在C#计算器上工作 - I'm trying to get my memory functions to work on a C# calculator 我正在努力使单声道android简单的“你好世界”,但我没有在模拟器中看到“你好世界”为什么? - I'm trying to make mono android simple “hello world” but I don't see “hello world” in the emulator why? c# - 尝试在图片框中播放视频 - c# - trying to play a video in a picturebox 我正在尝试使用C#创建我的第一个Web表单应用程序 - I'm trying to create my first web form app using c# 我正在尝试从 xml 文件中读取正则表达式,但是当我将正则表达式传递给 C# 代码时,却得到了错误匹配 - I'm trying to read a Regex from an xml file but when i pass on the Regex to the C# code but I'm getting false matches C#如何使用DirectShow(quartz.dll)从内存流播放视频? - C# How Can I Play A Video From A Memory Stream Using DirectShow(quartz.dll)? 使用 C# 从 blob 数据 Oracle 播放视频 - Play video from blob data Oracle using C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM