在Windows Media Player中播放StreamingAssets文件夹中的视频?(Unity 3D)

问题描述 投票:0回答:1

这是关于Unity 3d的问题。我可以播放StreamingAssets文件夹中的视频。但有没有一种方法可以点击按钮,并在Windows Media Player中播放相同的视频。我对此进行了很多研究,但找不到任何解决方案。

这是正常播放视频的代码,

using UnityEngine;
using System.Collections;


public class VideoDemo : MonoBehaviour
{

public string filePath;
public string result;

void Start() {
    filePath = System.IO.Path.Combine (Application.streamingAssetsPath, "Demo.mp4");
    result = "";

}

void OnGUI() {
if(GUI.Button(new Rect(10,10,100,30),"Click Me"))
    {
        StartCoroutine(Example());
    }
}

IEnumerator Example ()
{
    if (filePath.Contains ("://")) {
        WWW www = new WWW (filePath);
        yield return www;
        result = www.text;

    } else
    {
        result = System.IO.File.ReadAllText (filePath);

    }
 }

    }

请分享一些想法。

unity3d windows-media-player
1个回答
0
投票

This post涵盖使用Process.start在其默认处理程序中打开文件或使用特定应用程序(如notepad.exe)。您应该能够使用突出显示here的命令来定位Windows媒体播放器

ATH。

© www.soinside.com 2019 - 2024. All rights reserved.