NetrisTV / ws-scrcpy

Web client prototype for scrcpy.
MIT License
1.69k stars 331 forks source link

Support linux/window host for ios devices #195

Open drauggres opened 2 years ago

drauggres commented 2 years ago

Discussed in https://github.com/NetrisTV/ws-scrcpy/discussions/194

Originally posted by **wanliLiu** April 9, 2022 currently ios device detect use lib `ios-device-lib`, and this lib can only run in mac or windows,not run in Linux. as for run xctest use appium default way `xcodebuild`, so , all of this lead to cannot run in linux. and this lib [tidevice](https://github.com/alibaba/taobao-iphone-device) can fix it, use `tidevice list ` fix ios device detect, and run xctest use `tidevice xctest -B com.facebook.wda.WebDriverAgent.Runner`, thus ,because it wirted in python, so **it** can run in mac windows and linux. I have done all of this in this project,it works, by the way, video stream use mjpeg
krishtoautomate commented 2 years ago

new SubpPocess("tidevice",["-u",options.serial, "xctest", "-B","com.apple.test.W ebDriverAgentRunner-Runner"])

Can be added to webdriveragentrunner file, also increases speed of ios loading by 10x times

krishtoautomate commented 2 years ago

extends ProcessRunner {

can be used to implement tidevice similar to ws-qvh.

existing xcuitest driver can be reused with below changes as xcode build is not required

        await server.driver.createSession({
            platformName: 'iOS',
            deviceName: 'my iphone',
            udid: this.udid,
            wdaLocalPort: this.wdaLocalPort,
            usePrebuiltWDA: true,
            mjpegServerPort: remoteMjpegServerPort,
            webDriverAgentUrl: "http://127.0.0.1:"+this.wdaLocalPort
        });
        // await server.driver.wda.xcodebuild.waitForStart(new timing.Timer().start());
        // if (server.driver?.wda?.xcodebuild?.xcodebuild) {
        //     server.driver.wda.xcodebuild.xcodebuild.on('exit', (code: number) => {
        //         this.started = false;
        //         this.starting = false;
        //         server.driver.deleteSession();
        //         delete this.server;
        //         this.emit('status-change', { status: 'stopped', code });
        //         if (this.holders > 0) {
        //             this.start();
        //         }
        //     });
        // } else {
        //     this.started = false;
        //     this.starting = false;
        //     delete this.server;
        //     throw new Error('xcodebuild process not found');
        // }