Bug
搜索出的视频不能播放
拉取过来的视频有远端的clip
,显示黑屏也无法进行操作
在搜索结果页SearchResultActivity
像首页一样过滤出本地的时候,同时在后台进行拉取远端视频
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| private suspend fun doSearchBySearchGroupList( keyArray: List<SearchGroup>, replaceAll: Boolean = true, beginCursor: String = "" ) {
val log = logger.withTag(TAG, "Search", "searchByLabelKeyArray") log.i("keyArray = $keyArray, replaceAll = $replaceAll, beginCursor = $beginCursor")
if (!replaceAll && beginCursor.isEmpty()) { logger.w(TAG, "ignore not replaceAll AND beginCursor empty to prevent repeat item") return }
uiActionRequiredEvent.postValue(UiAction(UI_ACTION_BEGIN_REFRESH)) sideLoadLabelKeys(keyArray) log.d("begin refresh")
val list = performOnIOWithDefault(emptyList()) {
val resultClipsList = ArrayList<Clip>() var currentCursor = beginCursor
do { log.d("getClipsListByLabel, c = $currentCursor, size = ${resultClipsList.size}")
val allKeys = ArrayList<String>() keyArray.forEach { it.keys.forEach { k -> allKeys.add(k) } }
val resp = sdk.getClipsListByLabel(currentCursor, allKeys).await()
resp.nextCursor.run { log.d("getClipsListByLabel, nextCursor = $this") currentCursor = this nextCursor = this }
val filteredResultClipList = resp.list?.filter { clip -> clip.containsSearchGroups(keyArray) } filteredResultClipList?.let { resultClipsList.addAll(it) }
} while (resultClipsList.size < 30 && currentCursor.isNotEmpty())
resultClipsList }
val localList = list.filter { it.playMode == Clip.CLIP_PLAY_MODE_LOCAL }.toMutableList()
if (replaceAll && localList.isEmpty()) { uiActionRequiredEvent.postValue(UiAction(UI_ACTION_BACK)) log.i("no result, back") }
if (replaceAll) { searchResultAdapter.replaceAll(list) } else { searchResultAdapter.addAll(localList) }
withContext(Dispatchers.Main) { uiActionRequiredEvent.postValue(UiAction(UI_ACTION_END_REFRESH, replaceAll)) log.d("end refresh") } }
|
同时拉取远端视频
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
@SuppressLint("CheckResult") private fun filterPlayList(list: List<Clip>): List<Clip> { val localList = list.filter { it.playMode == Clip.CLIP_PLAY_MODE_LOCAL }.toMutableList() val remoteList = list.filter { it.playMode == Clip.CLIP_PLAY_MODE_REMOTE_DEVICE }.toMutableList()
logger.d(TAG, "localList size=${localList.size}, remoteList size=${remoteList.size}")
getRemoteList(remoteList)
return localList }
private fun getRemoteList(remoteList: List<Clip>) { if (remoteList.isEmpty()) { logger.d(TAG, "RemoteList is empty.") return } if (!NetworkUtil.isUsingNotMeteredNetwork(getApplication())) { logger.d(TAG, "Not currently connected to Wi-Fi.") return } val avDataPacketList = ArrayList<Observable<AvDataPacket>>() remoteList.forEach { val data = it.originalDataList?.get(0) data?.apply { avDataPacketList.add( sdk.getDeviceOriginalData( deviceID, startTimeMillis, endTimeMillis, 30 ) ) } } logger.d(TAG, "AvDataStreamObservable List size=${avDataPacketList.size}") Observable.concat(avDataPacketList).onErrorComplete().doOnComplete { logger.i(TAG, "fetch remote data complete, but there may be some errors and omissions") }.doOnError { logger.e(TAG, "error = $it") }.subscribe()
}
|
New
收藏和转发给好友页面限制竖屏
9c36ed7672851dfda78b85ee549ff24ab9681b57
1 2 3 4 5 6 7 8 9
| <activity android:name=".ui.user.FavoriteActivity" android:exported="false" android:screenOrientation="portrait" />
<activity android:name=".ui.share.ListShareToContactActivity" android:exported="false" android:screenOrientation="portrait" />
|