google cast - Android - Unable to add to RemoteMediaPlayer queue by calling queueInsertItems() multiple times -
i using castcompanionlibrary add items remotemediaplayer queue calling queueinsertitems() videocastmanager.java so:
queueinsertitems(unique_items, mediaqueueitem.invalid_item_id, customdata);
the first few requests go through, after few times, start getting transientnetworkdisconnectionexception , subsequent requests return status code 2103 (replaced). @ point, can no longer add items media queue until disconnect , reconnect cast device.
here copy of logcat:
01-28 00:24:56.750 7185-7185/com.google.sample.cast.myplayer d/ccl_videocastmanager: [v2.7.1] > queueinsertitems returned. status code: 2103 01-28 00:24:56.789 455-469/? i/surfaceflinger: id=5534(5) createsurf 0x41449a94 (1x1),1 flag=4, uoast 01-28 00:24:56.805 463-1700/? d/powermanagerservice: [api] acquire wakelock flags=0x2000000a > tag=windowmanager uid=1000 pid=463 01-28 00:24:56.891 7185-7189/com.google.sample.cast.myplayer d/dalvikvm: gc_concurre> nt freed > 1843k, 28% free 18679k/25856k, paused 4ms+16ms, total 201ms 01-28 00:24:57.008 28371-12138/? d/castsocket: [controller-0688 api] ioexception encountered. > tearing down socket. java.io.ioexception: invalid message size (138391) received. @ com.google.android.gms.cast.c.o.n(sourcefile:457) @ com.google.android.gms.cast.c.o.j(sourcefile:686) @ com.google.android.gms.cast.c.v.b(sourcefile:35) @ com.google.android.gms.cast.c.w.run(sourcefile:103) @ java.lang.thread.run(thread.java:856) 01-28 00:24:57.016 28371-12138/? d/castsocket: [controller-0688 api] shutdown reason=2 01-28 00:24:57.016 28371-28371/? d/castdevicecontroller: [controller-0688 api] ondisconnected; > socketerror="2 io error" 01-28 00:24:57.023 28371-9680/? d/castdevicecontroller: [controller-0688 api] > onsocketdisconnectedinternal: socketerror="2 io error" 01-28 00:24:57.023 28371-9680/? i/castdevicecontroller: [controller-0688 api] finishdisconnecting; > socketerror="2 io error", mdisconnectstatuscode=success 01-28 00:24:57.023 28371-9680/? i/castdevicecontroller: [controller-0688 api] listener.> ondisconnected(network_err
one thing notice in logcat castsocket api keeps shutting down reason 2 due invalid message size. i'm not sure means or why it's happening. kindly explain going on?
thanks in advance!
each request/api transferred using generic message , each message has max size; should assume payload can't beyond 64k keep in mind message made of bunch of things , add up. error seeing invalid message size makes me think running issue. try sending less items. also, note current structure, not enough break queue of, say, 500 items 20 messages 25 items in each; although can that, run issues shortly after since update messages receiver sends connected senders follow same size limit, fail if need report on huge number of item. might best, given current limitations, if somehow manage queue in way @ each moment in time, receiver doesn't hold many items in memory, while, @ same time, knows how more items (cloud) backend when needs to. may consider doing more management on sender side avoid pushing many queue items queue on receiver , unload queue items , add new ones keep total in-memory number low.finally, try reduce info each item send receiver little possible; example, receiver may not need have fields/metadata available item, or given ui structure on tv, may not able show any, say, description beyond 100 characters, trim info receiver absolutely needs. then, on sender side, can retrieve full info/metadata each item cloud directly if second sender joins party, gets minimal data receiver , fills gap going cloud directly rather relying on metadata receiver can send it.
hope helps.
Comments
Post a Comment