@@ -19,7 +19,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
1919import com.alibaba.fastjson.JSON
2020import com.alibaba.fastjson.JSONArray
2121import com.tencent.iot.explorer.link.demo.App
22- import com.tencent.iot.explorer.link.demo.BaseActivity
2322import com.tencent.iot.explorer.link.demo.R
2423import com.tencent.iot.explorer.link.demo.VideoBaseActivity
2524import com.tencent.iot.explorer.link.demo.common.util.CommonUtils
@@ -137,7 +136,6 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
137136 player = IjkMediaPlayer ()
138137
139138 Thread (Runnable {
140- connectStartTime = System .currentTimeMillis()
141139 var id = " ${App .data.accessInfo!! .productId} /${presenter.getDeviceName()} "
142140 var started = XP2P .startServiceWithXp2pInfo(id,
143141 App .data.accessInfo!! .productId, presenter.getDeviceName(), " " )
@@ -149,14 +147,14 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
149147 return @Runnable
150148 }
151149
150+ connectStartTime = System .currentTimeMillis()
152151 var tmpCountDownLatch = CountDownLatch (1 )
153152 countDownLatchs.put(" ${App .data.accessInfo!! .productId} /${presenter.getDeviceName()} " , tmpCountDownLatch)
154153 tmpCountDownLatch.await()
155154
156155 urlPrefix = XP2P .delegateHttpFlv(" ${App .data.accessInfo!! .productId} /${presenter.getDeviceName()} " )
157156 if (! TextUtils .isEmpty(urlPrefix)) {
158157 player?.let {
159- startShowVideoTime = System .currentTimeMillis()
160158 resetPlayer()
161159 keepPlayerplay(" ${App .data.accessInfo!! .productId} /${presenter.getDeviceName()} " )
162160 }
@@ -168,7 +166,7 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
168166 if (TextUtils .isEmpty(id)) return
169167
170168 // 开启守护线程
171- Thread ( Runnable {
169+ Thread {
172170 var objectLock = Object ()
173171 while (true ) {
174172 var tmpCountDownLatch = CountDownLatch (1 )
@@ -190,6 +188,7 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
190188 }
191189 Log .d(tag, " id=${id} , try to call startServiceWithXp2pInfo" )
192190 }
191+ connectStartTime = System .currentTimeMillis()
193192
194193 Log .d(tag, " id=${id} , call startServiceWithXp2pInfo successed" )
195194 countDownLatchs.put(id!! , tmpCountDownLatch)
@@ -200,7 +199,7 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
200199 urlPrefix = XP2P .delegateHttpFlv(id)
201200 if (! TextUtils .isEmpty(urlPrefix)) resetPlayer()
202201 }
203- }) .start()
202+ }.start()
204203 }
205204
206205 private fun resetPlayer () {
@@ -400,6 +399,8 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
400399 }
401400
402401 private fun setPlayerUrl (suffix : String ) {
402+ showTip = false
403+ startShowVideoTime = System .currentTimeMillis()
403404 player?.let {
404405 val url = urlPrefix + suffix
405406 it.reset()
0 commit comments