Ask a Question
GoPro Support Hub Ask a question. Share an answer. Find a solution. Stay stoked.
Is your GoPro gear up to date? Check to see If it is on our Update page.

개발자 문서: 앱에서 Quik 편집 생성 방법(Quik API)

by GoPro ‎10-03-2019 04:30 PM - edited ‎01-28-2021 10:22 AM
무엇을 하려고 합니까?

개발자 문서: 앱에서 Quik 편집 생성 방법(Quik API)

어떻게 하시겠습니까?

API를 사용하여 앱에서 Quik 편집을 생성하는 방법에 대해 알아보세요.

어디에 해당됩니까?

모바일용 Quik - Android

작업 방법

Quik 프로젝트 생성

Quik 앱은 다음 사양을 준수하여 `com.stupeflix.replay` 패키지의 모든 인텐트에 응답합니다.

<intent-filter>    <action android:name="android.intent.action.SEND"/>    <action android:name="android.intent.action.SEND_MULTIPLE"/>    <category android:name="android.intent.category.DEFAULT"/>    <data android:mimeType="image/*"/>    <data android:mimeType="video/*"/></intent-filter>

미디어 컬렉션은 해당 인텐트에 첨부된 `ClipData` 내에 있어야 하며(보존 권한), 이는 매우 중요합니다.

발신자 앱은 아래와 같이 인텐트가 Quik 앱을 대상으로 하도록 강제 적용할 수 있습니다.

Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);intent.setPackage("com.stupeflix.replay");// "clipData" contains all your URIsintent.setClipData(clipData);intent.setType("image/*, video/*");// Set read permissions flag for us to resolve (via ContentProvider)// any ContentUri attached to the intent.// (be it a file on sender's internal storage).intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);if (intent.resolveActivity(getPackageManager()) != null) {  // Quik app is installed and can handle the feature}

Quik은 `content://` `file://` 또는 일반 경로 등 모든 종류의 로컬 URI를 처리할 수 있습니다. Quik은 외부 저장소가 없는 경우 프로세스 중 외부 저장소 권한을 요청합니다.

`content://` URI는 앱의 개인 저장소에서 해결할 수 있으며, 위와 같이 읽기 권한을 인텐트에 첨부하여 ContentProvider를 통해 액세스할 수 있도록 설정하면 됩니다.

Quik 1.4 이상: 구성형 프로젝트

Quik 1.4에서는 구성형 프로젝트 지원을 추가했습니다.  
“외부” 프로젝트 모드에서 Quik은 “외부” 프로젝트를 추후 다시 열 때 재사용할 수 있는 고유한 프로젝트 ID를 생성합니다.

    public void startQuik() {Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);        // Force intent to target Quik app.        intent.setPackage("com.stupeflix.replay");        intent.setType("image/*, video/*");        // "clipData" contains all your assets URIs. (max count: 75).        // Can be null if project_id is present then Quik will // use assets from project.        intent.setClipData(clipData);        /* Intent optional arguments */// enable_external_project        // -    true: enable external mode for this project, //Quik will result a project id to your activity.        // -    false: classic behaviour, keep project internal to Quik        intent.putExtra("enable_external_project", true);        // project_id, the unique Quik identifier for an external project.        // -    null: Quik create a new project with a new id.        // -    project id: restore a previous project in Quik// project ID must come from the Quik result, in your onActivityResult        // intent.putExtra("project_id", "<id>");        // add_assets (default true)        // -    true: Add ClipData's assets at the end of project        // -    false: Clear assets from existing project before adding ClipData's assets        // Ignored if project_id is null        intent.putExtra("add_assets", true);        // Set title for a project.        // If present, Quik does not show a Title dialog for a new project        intent.putExtra("project_title", "This is a title");        // enable_upload (default true)        // -    false: Disable video upload // (i.e. remove "share link" action during video save)        intent.putExtra("enable_upload", false);        // branding_off, available only on new project (default to user preference)        // -    true: Remove the official Quik Outro from the project timeline        // -    false: Add the Quik Outro in the timeline        intent.putExtra("branding_off", true);        // aspect_ratio, available only on new project (default to user preference)        // -    "square": aspect ratio 1/1        // -    "large": aspect ratio 16/9        intent.putExtra("aspect_ratio", "square");        // Suggested duration in seconds for a new project (default best Quik duration).        intent.putExtra("project_duration", 10);// Set a style, available styles are (same order as the app shows):// grammy,gopro,lumiere,lapse,slice,overlay,// blocky,simple,sport,glide,kinetic,swift,// palette,doisneau,donotblink,bold,diamond,split,// picnic,origami,lightpanes,bouncy,seasons_summer,// seasons_autumn,seasons_winter,seasons_spring// Available since Quik 1.4.1intent.putExtra("style", "gopro");// Use a random styleintent.putExtra("random_style", true);        // Where we should save the project video file. (default in DCIM/Quik/)        intent.putExtra("video_file_path", "/storage/emulated/0/DCIM/Quik/Quik_Video.mp4");        // Set read permissions flag for us to resolve any ContentUri attached to // the intent that resolve on your internal storage.        // (via ContentProvider)        intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);        if (intent.resolveActivity(getPackageManager()) != null) {            // Quik app is installed and can respond to the intent    // See below for possible results            startActivityForResult(intent, 42);        }    }    @Override    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {        if (requestCode == 42) {            if (resultCode == RESULT_OK) {                // Identifier of a project.                // Pass this id to the intent to re-open a previous Quik project.                String projectId = intent.getStringExtra("project_id");                // file video path                // -    null if the user didn't save his project into a file yet                // -    or absolute video file path of the saved file from a project                String videoFilePath = intent.getStringExtra("video_file_path");                // project URI in our provider (read only)                Uri projectUri = intent.getData();            } else if (resultCode == RESULT_CANCELED) {                if (intent != null) {                    int errorCode = intent.getIntExtra("error_code", -1);            // Possible error code :                // - 400 : ClipData is empty or null                    // - 403 : Your app doesn't have the permission to open the project.                }            }        }    }
Quik 1.6 이상: Quik 프로젝트 동영상 재생
Intent intent = new Intent(Intent.ACTION_VIEW);intent.setPackage("com.stupeflix.replay");// Play project video with id = 1Uri projectUri = Uri.parse("content://com.stupeflix.replay.provider/projects/1");intent.setData(projectUri);if (intent.resolveActivity(getPackageManager()) != null) {startActivityForResult(intent, 43); // result error_code = 400 if project does not exist}