@@ -165,11 +165,13 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
165165 countDownLatchs.put(" ${App .data.accessInfo!! .productId} /${presenter.getDeviceName()} " , tmpCountDownLatch)
166166 tmpCountDownLatch.await()
167167
168- urlPrefix = XP2P .delegateHttpFlv(" ${App .data.accessInfo!! .productId} /${presenter.getDeviceName()} " )
169- if (! TextUtils .isEmpty(urlPrefix)) {
170- player?.let {
171- resetPlayer()
172- keepPlayerplay(" ${App .data.accessInfo!! .productId} /${presenter.getDeviceName()} " )
168+ XP2P .delegateHttpFlv(" ${App .data.accessInfo!! .productId} /${presenter.getDeviceName()} " )?.let {
169+ urlPrefix = it
170+ if (! TextUtils .isEmpty(urlPrefix)) {
171+ player?.let {
172+ resetPlayer()
173+ keepPlayerplay(" ${App .data.accessInfo!! .productId} /${presenter.getDeviceName()} " )
174+ }
173175 }
174176 }
175177 }).start()
@@ -209,8 +211,10 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
209211 tmpCountDownLatch.await()
210212 Log .d(tag, " id=${id} , tmpCountDownLatch do not wait any more" )
211213
212- urlPrefix = XP2P .delegateHttpFlv(id)
213- if (! TextUtils .isEmpty(urlPrefix)) resetPlayer()
214+ XP2P .delegateHttpFlv(id)?.let {
215+ urlPrefix = it
216+ if (! TextUtils .isEmpty(urlPrefix)) resetPlayer()
217+ }
214218 }
215219 }.start()
216220 }
@@ -235,7 +239,7 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
235239 if (able) {
236240 var command = Command .getNvrIpcStatus(presenter.getChannel(), 0 )
237241 var repStatus = XP2P .postCommandRequestSync(" ${accessInfo.productId} /${presenter.getDeviceName()} " ,
238- command.toByteArray(), command.toByteArray().size.toLong(), 2 * 1000 * 1000 )
242+ command.toByteArray(), command.toByteArray().size.toLong(), 2 * 1000 * 1000 ) ? : " "
239243
240244 launch(Dispatchers .Main ) {
241245 var retContent = StringBuilder (repStatus).toString()
@@ -338,7 +342,7 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
338342 App .data.accessInfo?.let {
339343 if (command.length <= 0 ) return @Runnable
340344 var retContent = XP2P .postCommandRequestSync(" ${it.productId} /${presenter.getDeviceName()} " ,
341- command.toByteArray(), command.toByteArray().size.toLong(), 2 * 1000 * 1000 )
345+ command.toByteArray(), command.toByteArray().size.toLong(), 2 * 1000 * 1000 )? : " "
342346 launch(Dispatchers .Main ) {
343347 if (TextUtils .isEmpty(retContent)) {
344348 retContent = getString(R .string.command_with_error, command)
0 commit comments