Mobile Development 20 min read

How Youku Leverages HarmonyOS for Seamless Multi‑Screen Interaction

This article details Youku's strategic partnership with Huawei, explaining how HarmonyOS's distributed capabilities enable continuous and collaborative multi‑screen experiences such as seamless video flow, free‑view angles, and advanced casting, while also presenting the underlying architecture, protocols, and code implementations.

Alibaba Terminal Technology
Alibaba Terminal Technology
Alibaba Terminal Technology
How Youku Leverages HarmonyOS for Seamless Multi‑Screen Interaction

Youku and Huawei maintain a long‑term strategic partnership aimed at delivering high‑quality audio‑visual experiences. HarmonyOS’s flow features introduce new multi‑screen interaction patterns. This article uses Youku Play Center’s technical foundation to illustrate how core capabilities like ordinary flow, free‑view, and zoom are realized on HarmonyOS.

Background

Huawei defines distributed experience as comprising continuity and collaboration.

Continuity Experience

When a user starts an operation on one device and switches to another, the new device continues the task instantly, covering both task and audio‑video continuity.

Collaboration Experience

Software and hardware across multiple devices cooperate to provide a more efficient, immersive experience, including software and hardware collaboration.

Youku already offers multi‑screen features such as:

User watches a video on a phone, then continues at the same point on a tablet.

User casts a video from phone or tablet to a smart screen or TV box.

User scans a QR code on a large screen with a phone to log in or pay.

These functions use existing Huawei features like "One‑Touch Transfer" and "HiPlay". Youku aims to develop exclusive HarmonyOS features that complement the Android client, allowing both codebases to interoperate.

Youku’s client spans Android, iOS, iPad, OTT, etc., naturally supporting multi‑screen scenarios.

HarmonyOS’s distributed technologies make app development independent of device form factors, letting developers focus on business logic.

In the HarmonyOS version, Youku combines HarmonyOS’s distributed bus with its existing casting to create a new multi‑screen interaction FA, enabling video flow from phone to other HarmonyOS devices and remote control of playback.

The FA is 100% written with HarmonyOS APIs. Users tap the "Video Flow" button on the Youku HarmonyOS page to transfer playback to other HarmonyOS devices and control volume, playback speed, clarity, and episode selection, as well as rotate free‑view videos.

Casting Overview

Casting technologies like AirPlay, Miracast, and Chromecast have driven multi‑screen evolution. Youku’s casting capabilities cover traditional LAN protocols (DLNA, AirPlay) and a self‑developed cloud casting protocol that overcomes LAN multicast limitations. NFC stickers enable "one‑touch" casting on Magic Screen devices.

Device Discovery (Code)

// HarmonyOS search
if (HarmonyCastMgr.haveInst()) {
    HarmonyCastMgr.getInst().searchDevs();
    // Free‑view search
    if (HarmonyCastMgr.getInst().hasMirr()) {
        HarmonyCastMgr.getInst().searchHarmonyMirrorDevs();
    }
}
public boolean searchDevs() {
    boolean ret = false;
    if (isHarmonyEnable()) {
        Intent intent = new Intent();
        ComponentName componentName = new ComponentName(PackageContant.PACKAGE_YOUKU, "com.youku.feature.MiddlewareAbility");
        intent.setComponent(componentName);
        intent.putExtra(AbilityUtils.PARAM_KEY_INSTALL_ON_DEMAND, true);
        intent.setAction("action.videoplayer.getdevicelist");
        try {
            mActivity = YoukuContext.getTopActivity();
            ret = AbilityUtils.connectAbility(mActivity, intent, mServiceConnection);
        } catch (RuntimeException e) {
            e.printStackTrace();
            ret = false;
        }
    }
    return ret;
}
public ServiceConnection mServiceConnection = new ServiceConnection() {
    @Override
    public void onServiceConnected(ComponentName name, IBinder service) {
        HarmonyRCS rcs = new HarmonyRCS(service);
        String[] devices = null;
        try {
            devices = rcs.getDeviceList();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        // Map device IDs and names
        List<String> deviceIdList = new ArrayList<>();
        List<String> deviceNameList = new ArrayList<>();
        for (int i = 0; i < devices.length; i++) {
            if ((i & 1) == 0) {
                deviceIdList.add(devices[i]);
            } else {
                deviceNameList.add(devices[i]);
            }
        }
        if (deviceNameList.size() >= deviceIdList.size()) {
            mHarmonyDevs.clear();
            for (int i = 0; i < deviceIdList.size(); i++) {
                String deviceId = deviceIdList.get(i);
                String deviceName = deviceNameList.get(i);
                if (StringUtils.isNotBlank(deviceId) && StringUtils.isNotBlank(deviceName)) {
                    Client client = new Client();
                    // ... set client fields ...
                    mHarmonyDevs.put(deviceId, client);
                }
            }
            // Additional logic omitted for brevity
        }
        // Disconnect after use
        try {
            if (mActivity != null) {
                AbilityUtils.disconnectAbility(mActivity, mServiceConnection);
            }
        } catch (Exception pE) {
            pE.printStackTrace();
        }
    }

    @Override
    public void onServiceDisconnected(ComponentName name) {
        LogEx.d(tag(), "onServiceConnected");
    }
};

Free‑View

Developed by Alibaba’s MoCo Lab, free‑view allows users to slide video, change perspective, and zoom, delivering an immersive experience for events like sports. It requires high bitrate (6K‑8K) and heavy decoding, so Youku initially used flow to transmit the M3U8 address, but later adopted Huawei Cast+ for better performance.

Challenges and Solutions

Issues included the remote control page being mirrored to the large screen and orientation switches causing extra screen rotations. The final solution mirrors only the Dialog‑level UI containing the SurfaceView, preserving playback state and reducing startup latency.

Online Performance

Community feedback shows strong interest in HarmonyOS features and Youku’s HarmonyOS version, with several demo videos shared online.

Summary

During the development of Youku’s HarmonyOS multi‑screen interaction, both parties tackled incomplete interfaces and debugging environments, quickly mastering HarmonyOS stacks, delivering numerous features, and providing valuable feedback to Huawei. The collaboration resulted in pioneering video interaction forms for HarmonyOS, expanding multi‑screen capabilities for Youku and laying groundwork for future innovations.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

HarmonyOSmulti-screenCasting
Alibaba Terminal Technology
Written by

Alibaba Terminal Technology

Official public account of Alibaba Terminal

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.