json - How to send the JSONArray to Receiver app from the sender app for chromecast in android -
unable send jsonarray values receiver app sender app using mediainfo.builder class. have used setcustomdata(jsonobject obj) can send jsonobject possible need send jsonarray receiver app using setcustomdata() method if possible, otherwise if have other default method or idea send jsonarray values receiver app chromecast please tell me.
thanks in advance.
i have tried jsonobject :
mediametadata mediametadata = new mediametadata( mediametadata.media_type_music_track); mediametadata.putstring(mediametadata.key_album_artist, "" + singers.gettext().tostring()); mediametadata.putstring(mediametadata.key_album_title, "" + songtitle.gettext().tostring()); mediainfo mediainfo = new mediainfo.builder(songurl) .setcontenttype("audio/mp3") .setstreamtype(mediainfo.stream_type_buffered) // here set customdata {"music":"illayaraja","album_id":"t0000266","duration":"04:57",....} .setcustomdata(customjsonobj) .setmetadata(mediametadata).build(); mremotemediaplayer .load(mapiclient, mediainfo, true) .setresultcallback( new resultcallback<remotemediaplayer.mediachannelresult>() { @override public void onresult(mediachannelresult result) { if (result.getstatus().issuccess()) { log.d(tag, "media loaded successfully" + result.getstatus()); } else { log.d(tag, "media loaded not successfully" + result.getstatus()); } } });
but need pass jsonarray values receiver app
"customdata": [ { "songid": 236854, "songtitle": "kadal anukkal", "cdimg": "http://cdn.raaga.com/r_img/250/t/t0002491.jpg", "lyricist": "vairamuthu", "lang": "t", "singers": "vijay prakash, shreya ghoshal", "album": "enthiran", "album_id": "t0002491", "music": "ar. rahman", "duration": "05:46" }, ]
here 1 idea: use jsonobject wrap jsonarray. here example:
try { jsonobject myjsonobject; myjsonobject.put("field1", "value1"); jsonarray myjsonarray = new jsonarray(); myjsonarray.put(myjsonobject); jsonobject jsonarraywrapper = new jsonobject(); jsonarraywrapper.put("myarray", myjsonarray); } catch (jsonexception e) { log.d("tag", e.getmessage()); }
Comments
Post a Comment