Public void OnButtonClick ()
{
String videourl="";
StartCoroutine (downloadVideo (videourl));
}
IEnumerator downloadVideo (string videourl)
{
WWW WWW=new WWW (videourl);
Yield return WWW.
If (www.isDone)
{
//download video to the video format: mp4)
//Application. The persistentData path
}
}
Can put receives an array of bytes by www.bytes into not memory literatures to local and then in the play?
MemoryStream ms=new MemoryStream (www.bytes);
FileStream fs=new FileStream (Application. PersistentData, FileMode. CreateNew);
StreamWriter sw=new StreamWriter (ms);
Sw. WriteTo (fs);
Ms. Close ();
Fs. The Close ();
Sw. The Close ();
In this way, ok?
CodePudding user response:
Struggle for two days finally found the way is to receive a byte array into a file stream it is ok to deposit to the local specific code below
FileStream fs=new FileStream (Application. PersistentData, FileMode. Creat, FileAccess. Write);
Fs. Write (www.bytes, 0, www.bytes.length).
Fs. The Close ();
Is the above three sentences code can be so simple I struggled for two days the reason or solid basic skills is not the basic flow operating all don't know