user3836982
user3836982

Reputation: 148

Play video on Unity without extension

i have this problem, i created an application that play videos but this video haven't extension , so per example i have video like

big_buck_bunny

instead a file like :

big_buck_bunny.mp4

I cant convert this video. There is a way to play a video from remote without extension? I have a url like :

D:\\Software\\Marmotta\\marmotta-home\\resources\\88\\95\\43\\big_buck_bunny

Thanks all for help

Upvotes: 2

Views: 262

Answers (2)

Scott Chamberlain
Scott Chamberlain

Reputation: 127553

You can use Directory.GetFiles to get all files in a folder filtered to your filename. Be sure to include using System.IO; at thte top of the file.

var path = "D:\\Software\\Marmotta\\marmotta-home\\resources\\88\\95\\43\\big_buck_bunny"
var directory = Path.GetDirectoryName(path);
var filename = Path.GetFileName(path);
string[] files = Directory.GetFiles(directory, filename + ".*", SearchOption.TopDirectoryOnly);

the array files will hold a list of all the files in the folder that started with the name big_buck_bunny, one of those files will be the one you want to use.

Upvotes: 0

user6157004
user6157004

Reputation:

What about adding the extension at the end of the file?

String path = "D:\\Software\\Marmotta\\marmotta-home\\resources\\88\\95\\43\\big_buck_bunny";
path += @".mp4";

Upvotes: 0

Related Questions