private void loadFragment() { Intent intent = getIntent(); Fragment fragment = new LoginFragment(); Bundle extras = intent.getExtras(); if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData(); String url = null; try { url = URLDecoder.decode(uri.toString(), "UTF-8") .replace("https://kalturaplay.appspot.com/play?", ""); } catch (UnsupportedEncodingException e) { Log.w(TAG, "couldn't decode/split intent url"); e.printStackTrace(); } if (url != null) { extras.putSerializable("config", KPPlayerConfig.valueOf(url)); fragment = new FullscreenFragment(); } else { Log.w(TAG, "didn't load iframe, invalid iframeUrl parameter was passed"); } } FragmentUtilities.loadFragment(false, fragment, extras, getFragmentManager()); }
@Override public void onFragmentInteraction(Uri uri) { Intent intent = getIntent(); Fragment fragment = new FullscreenFragment(); Bundle extras = intent.getExtras(); if (extras == null) { extras = new Bundle(); } KPPlayerConfig config = new KPPlayerConfig("http://qa-apache-testing-ubu-01.dev.kaltura.com", "15067411", "1091") .setEntryId("0_0jhktrbo"); config.setCacheSize(0.8f); extras.putSerializable("config", config); FragmentUtilities.loadFragment(false, fragment, extras, getFragmentManager()); }
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); } }