I want to try the WWW load streamingAssets file specific follow-up function will need a MP4 and then returns the file name
I like to write a code
Using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Public class GetName: MonoBehaviour {
Public MediaPlayerCtrl scrMedia;
Public bool m_bFinish=false;
Private string _result;
//Use this for initialization
Void the Start () {
StartCoroutine (GetFileName ());
}
//Update is called once per frame
Void the Update () {
}
IEnumerator GetFileName () {
The string url=Application. StreamingAssetsPath + "/fengjing. Mp4";
WWW WWW=new WWW (url);
Yield return WWW.
_result=www.text;
}
Void OnGUI () {
If (GUI. The Button (new the Rect (50,50,100,100), "Load"))
{
ScrMedia. Load (_result);
M_bFinish=false;
}
}
}
But not succeed if it is scrMedia directly. The Load (" fengjing. Mp4 "); It'd be playing
Should be _result is not returned by the file name should be how to modify the first thank you
CodePudding user response:
With the method can directly do, why use WWWWCodePudding user response: