Home > other >  Turn the unity on the android platform streamingAssets file to read
Turn the unity on the android platform streamingAssets file to read

Time:09-23

Already have a functional load (" XXX. MP4 ") can play the streamingAssets folder specified video
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 WWWW

CodePudding user response:

reference 1st floor DOwnstairs response:
with the method can directly do, why use WWWW


I'm here just at the time of test formal use is don't know the file name

CodePudding user response:

reference 1st floor DOwnstairs response:
with the method can directly do, why use WWWW

Android does not use the NDK way, read the catalogue only via WWW

CodePudding user response:

System.IO.Path.Com bine (XXX, yyy)
You can try this, this is the two strings together,

  • Related