Play video from StreamingAssets folder in Windows Media Player?(Unity 3D)

This is a question On Unity 3d. I can play video which is there in my StreamingAssets folder. But is there a way in which I click a button and the same video gets played in the Windows Media Player. I researched a lot on this but could not find any solution.

This is the code for playing video normally,

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);

    }
 }

    }

Kindly share some ideas.

Answers


This post covers using Process.start to open up files in their default handlers or using a specific app, like notepad.exe. You should be able to target Windows media player using commands highlighted here

ath.


Need Your Help

Insert into MySQL Table PHP

php mysql sql syntax-error sql-insert

I am having some trouble making a simple form to insert data into a MySQL table. I keep getting this SQL error:

Time between button press and release in python?

python raspberry-pi

I am trying to time from the start of a button press to the end of a button press on GPIO (in order to differentiate between a long press and a short press). I want to use a callback to get the but...