How to play videos in android from assets folder or raw folder?

## Perfectly Working since Android 1.6 ## getWindow().setFormat(PixelFormat.TRANSLUCENT); VideoView videoHolder = new VideoView(this); //if you want the controls to appear videoHolder.setMediaController(new MediaController(this)); Uri video = getUriFromRawFile(context, R.raw.your_raw_file); //if your file is named sherif.mp4 and placed in /raw //use R.raw.sherif videoHolder.setVideoURI(video); setContentView(videoHolder); videoHolder.start(); And then public static Uri getUriFromRawFile(Context context, @ResRaw int rawResourceId) { return Uri.Builder() … Read more

Play audio file from the assets directory

player.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength()); Your version would work if you had only one file in the assets directory. The asset directory contents are not actually ‘real files’ on disk. All of them are put together one after another. So, if you do not specify where to start and how many bytes to read, the player will read up … Read more

Using fonts with Rails asset pipeline

If your Rails version is between > 3.1.0 and < 4, place your fonts in any of the these folders: app/assets/fonts lib/assets/fonts vendor/assets/fonts For Rails versions > 4, you must place your fonts in the app/assets/fonts folder. Note: To place fonts outside of these designated folders, use the following configuration: config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/ For Rails … Read more

Using Resources Folder in Unity

You can’t read the Resources directory with the StreamReader or the File class. You must use Resources.Load. 1.The path is relative to any Resources folder inside the Assets folder of your project. 2.Do not include the file extension names such as .txt, .png, .mp3 in the path parameter. 3.Use forward slashes instead of back slashes … Read more