Browse Source

fix(player): enforce playback state bridge singleton

onecold 4 tháng trước cách đây
mục cha
commit
0a585cf656

+ 3 - 0
entry/src/main/ets/controller/PlaybackStateBridge.ets

@@ -21,6 +21,9 @@ export class PlaybackStateBridge {
     durationMs: 0
   }
 
+  private constructor() {
+  }
+
   public static getInstance(): PlaybackStateBridge {
     if (!PlaybackStateBridge.instance) {
       PlaybackStateBridge.instance = new PlaybackStateBridge()

+ 3 - 1
entry/src/ohosTest/ets/test/List.test.ets

@@ -14,7 +14,9 @@
  */
 
 import abilityTest from './Ability.test'
+import playbackStateBridgeTest from './PlaybackStateBridge.test'
 
 export default function testsuite() {
   abilityTest()
-}
+  playbackStateBridgeTest()
+}