Log in or register to post comments

iOS Video Playback non local file.

August 10, 2012 - 10:18am #1

I want to play a video on a tracker in iOS but I do not want to bundle the video into the application. I'm attempting to download the video witht he following code :

 

WWW www = null;

 

void Awake ()

{

StartCoroutine(Download());

}

 

 

 

IEnumerator Download () {

www = new WWW("http://c542863.r63.cf2.rackcdn.com/absolutvodka_greyhound2.mp4"); 

StartCoroutine(download_percentage());

yield return www;

System.IO.File.WriteAllBytes(Application.temporaryCachePath + "/absolutvodka_greyhound2.mp4", www.bytes);

Debug.Log(Application.dataPath);

Debug.Log(Application.streamingAssetsPath);

Debug.Log(Application.temporaryCachePath);

Application.LoadLevel("Vuforia-VideoPlayback");

}

 

 

IEnumerator download_percentage(){

bool done = false;

while(!done){

if (www.progress == 1){

done = true;

}

Debug.Log("Download Progress:" +www.progress);

yield return new WaitForSeconds(0.5f);

}

yield return null;

}

 
And I'm setting the path video path on start with the following:

m_path = Application.temporaryCachePath + "/absolutvodka_greyhound2.mp4";

 
 
 I'm getting the following message in xcode.

Error - The asset's tracks were not loaded: The requested URL was not found on this server.


 What should I do differently?


Thanks

Joe Simms

Ad-Dispatch

 

iOS Video Playback non local file.

September 6, 2012 - 8:32am #3

Hi DispatchArt,

I'm getting the same error  "Error - The asset's tracks were not loaded:"  

just wondering if you worked out what the issue is with this ?


 regards,

          Mick

iOS Video Playback non local file.

August 10, 2012 - 11:33am #2

I hacked it into submission. I changed the following function in VideoPlayerHelper.cs

// Set the video filename

public void SetFilename(string filename) {

#if UNITY_ANDROID mFilename = filename; videoPlayerSetActivity();

if (videoPlayerIsFileInAssetsFolder(filename) || filename.Contains("://")) {

mFullScreenFilename = filename;

} else {

mFullScreenFilename = "file://" + filename;

}

#elif UNITY_IPHONE

mFilename = filename;

if (!filename.Contains("://")) {

// Not a remote file, assume this file is located in the StreamingAssets folder

mFilename = "../Library/Caches/" + filename;

}

mFullScreenFilename = filename;

#endif

}

Log in or register to post comments