public void loadItems(String fileName) { String itemsString = Utilities.readAssetToString(mContext, fileName); try { JSONObject content = new JSONObject(itemsString); JSONObject baseConfig = content.getJSONObject("baseConfig"); JSONObject items = content.getJSONObject("items"); for (Iterator<String> it = items.keys(); it.hasNext(); ) { String key = it.next(); KPPlayerConfig config = KPPlayerConfig.fromJSONObject(baseConfig); JSONObject jsonItem = items.getJSONObject(key); String entryId = getString(jsonItem, "entryId"); if (entryId == null) { continue; } config.setEntryId(entryId); String remoteUrl = getString(jsonItem, "remoteUrl"); String flavorId = getString(jsonItem, "flavorId"); config.setLocalContentId(key); config.addConfig("autoPlay", "true"); VideoItem item = new VideoItem(config, flavorId, remoteUrl, key); item.setContentManager(mContentManager); mVideoItems.add(item); } } catch (JSONException e) { Log.e(getClass().getSimpleName(), "Error parsing json", e); } }