-2

I am interested in Huawei HarmonyOS, after reading some online documents of HarmonyOS, I am still not clear whether the OS supports online URL playback. If it is supported, how to develop it. Can someone help?

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
Zinna
  • 1,947
  • 2
  • 5
  • 20

1 Answers1

-1

Yes, HarmonyOS video does support URL playback. Here is the sample code for you reference.

private void playUrl(Surface surface) {
    try {
        Source source = new Source("video url");
        mPlayer.setSource(source);
        mPlayer.setVideoSurface(surface);
        mPlayer.setPlayerCallback(new VideoPlayerCallback());
        mPlayer.prepare();
        mSurfaceProvider.setTop(0);
        mPlayer.play();
    }
}
Zinna
  • 1,947
  • 2
  • 5
  • 20