Exemplo n.º 1
0
    void SelectVideo()
    {
#if UNITY_EDITOR
        Debug.Log("SelectVideo In Editor");
        return;
#endif
        NativeGallery.GetVideoFromGallery(OnGetVideoCb, "Select Video");
    }
Exemplo n.º 2
0
 public void ChooseVideo()
 {
     NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
     {
         TargetBehavior target = FindObjectOfType <TargetBehavior>();
         if (path != null && target != null)
         {
             target.OnVideoChosen(path);
         }
     }, "Select a video'");
 }
Exemplo n.º 3
0
 /// <summary>
 /// Select video from native gallery
 /// </summary>
 /// <param name="path">video path</param>
 void PickVideo()
 {
     NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
     {
         if (path != null)
         {
             // Load picked video
             LoadVideo("file://" + path);
         }
     }, "Select Video");
 }
Exemplo n.º 4
0
 private void PickVideo()
 {
     NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
     {
         Debug.Log("Video path: " + path);
         if (path != null)
         {
             Handheld.PlayFullScreenMovie("file://" + path);
         }
     }, "Select a Video");
     Debug.Log("Permission result:" + permission);
 }
Exemplo n.º 5
0
    private void PickVideo()
    {
        NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
        {
            if (path != null)
            {
                _video.transform.GetChild(0).GetComponent <VideoPlayer>().url = "file://" + path;
            }
        }, "Escolha um video");

        Debug.Log("Permission result: " + permission);
    }
Exemplo n.º 6
0
    private void PickVideo()
    {
        NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
        {
            Debug.Log("Video path: " + path);
            if (path != null)
            {
                StartCoroutine(LoadVideo(path));
            }
        }, "Select a video");

        Debug.Log("Permission result: " + permission);
    }
Exemplo n.º 7
0
    private void PickVideo()
    {
        NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
        {
            Debug.Log("Video path: " + path);
            if (path != null)
            {
                // Play the selected video
                playVideo("file://" + path);
            }
        }, "Select a video");

        Debug.Log("Permission result: " + permission);
    }
Exemplo n.º 8
0
    public void PickVideoFromGallery()
    {
        NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
        {
            if (path != null)
            {
                // Play the selected video
                //Handheld.PlayFullScreenMovie("file://" + path);
                pathText.text = path;
            }
        }, "Select a video");

        Debug.Log("Permission result: " + permission);
    }
Exemplo n.º 9
0
    private void PickVideo()
    {
        NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
        {
            Debug.Log("Ruta del video: " + path);

            if (path != null)
            {
                // Muestra el video seleccionado
                Handheld.PlayFullScreenMovie("file://" + path);
            }
        }, "Selecciona un video");

        Debug.Log("Resultado de los permisos: " + permission);
    }
Exemplo n.º 10
0
    private void PickVideo()
    {
        NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
        {
            Debug.Log("Video path: " + path);
            if (path != null)
            {
                // Play the selected video
                Handheld.PlayFullScreenMovie("file://" + path);
            }
        }, "Select a video");

        Debug.Log("Permission result: " + permission);
        CanvasToHide.SetActive(true);
    }
Exemplo n.º 11
0
    private void PickVideo()
    {
        NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
        {
            Debug.Log("Video path: " + path);
            statusText.text = path;
            uploadscript.m_LocalFileName = path;
            if (path != null)
            {
                // Play the selected video
                Handheld.PlayFullScreenMovie("file://" + path);
            }
        }, "Select a video");

        Debug.Log("Permission result: " + permission);
    }
Exemplo n.º 12
0
        public void PickTrimPlay()
        {
            NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
            {
                if (path != null)
                {
                    // Play the selected video
                    config.inputPath = path;
                    //watermarkData.inputPath = path;
                    config.outputPath = path.Substring(0, path.Length - 4) + "_Trimmed.mp4";
                    //watermarkData.outputPath = path.Substring(0, path.Length - 4) + "_Trimmed.mp4";
                    pathNewVideoToPlay = config.outputPath;

                    FFmpegCommands.Trim(config);
                    //FFmpegCommands.Watermark(watermarkData);
                }
            }, "Select a video");
        }
Exemplo n.º 13
0
 /// <summary>
 /// 打开相册 选择一个视频
 /// </summary>
 public static void OpenVideo(Action <string> callBack)
 {
     NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((string path) =>
     {
         if (!string.IsNullOrEmpty(path) && callBack != null)
         {
             callBack(path);
         }
     });
     if (permission != NativeGallery.Permission.Granted)
     {
         ShowToast("当前没有相册访问权限,请在设置中打开");
         //打开应用程序设置
         if (NativeGallery.CanOpenSettings())
         {
             NativeGallery.OpenSettings();
         }
     }
 }
Exemplo n.º 14
0
    /// <summary>
    /// Pick a video from Gallery/Photos
    /// uses NativeGallery
    /// </summary>
    public void PickVideo()
    {
        if (NativeGallery.IsMediaPickerBusy())
        {
            return;
        }

        NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
        {
            Debug.Log("Video path: " + path);
            if (path != null)
            {
                // Play the selected video
                Handheld.PlayFullScreenMovie("file://" + path);
            }
        }, "Select a video");

        Debug.Log("Permission result: " + permission);
    }
Exemplo n.º 15
0
 /**
  * 打开原生相册选择 视频
  */
 private void IPhonePlayerSelectVideoOpenAlbum()
 {
     NativeGallery.Permission rest1 = NativeGallery.RequestIPhonePermission(4);
     NativeGallery.Permission rest2 = NativeGallery.RequestIPhonePermission(3);
     if (rest1 == NativeGallery.Permission.Granted)
     {
         NativeGallery.GetVideoFromGallery((backPath) =>
         {
             if (backPath.IsNotNullAndEmpty())
             {
                 // 打开原生视频选择
                 UIMgr.OpenPanel <AttendanceAddPanel>(new AttendanceAddPanelData()
                 {
                     BoxId         = mData.BoxId,
                     BoxDay        = mData.BoxDay,
                     Path          = backPath,
                     ThumbnailPath = Application.temporaryCachePath + "/videoThumbnail.png",
                     Action        = AttendanceAdd.Video,
                 }, UITransitionType.CIRCLE);
                 Close();
             }
         }, "选择视频", "video/*");
     }
 }
Exemplo n.º 16
0
    public void LoadVideoInsidePicture()
    {
        NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
        {
            Debug.Log("Video path: " + path);
            if (path != null)
            {
                foreach (GameObject element in GameObject.FindGameObjectsWithTag("TakePictureBtn"))
                {
                    element.SetActive(false);
                }

                NativeGallery.VideoProperties videoProperties = NativeGallery.GetVideoProperties(path);
                GameObject pictureVideo  = Instantiate(Resources.Load <GameObject>("Prefabs/Picture/PictureVideo"));
                StreamVideo streamScript = pictureVideo.GetComponent <StreamVideo>();
                pictureVideo.GetComponent <PictureController>().SetMediaPath(path);

                if (videoProperties.rotation == 180 || videoProperties.rotation == 0)
                {
                    streamScript.SetRotationVideo(videoProperties.rotation);
                }
                else
                {
                    streamScript.SetRotationVideo(videoProperties.rotation - 180);
                }
                streamScript.SetPath(path);
                streamScript.LoadVideoInsidePicture();

                EnableButtonPhoto();

                confirmSavePhotoBtn.GetComponent <SavePhotoController>().setPicture(pictureVideo);
                confirmCancelPhotoBtn.GetComponent <SavePhotoController>().setPicture(pictureVideo);
            }
        }, "Select a video");
        Debug.Log("Permission result: " + permission);
    }
Exemplo n.º 17
0
 // launches a platform-specific Gallery browser and returns the path of the selected file
 private void LaunchGalleryBrowser()
 {
     NativeGallery.GetVideoFromGallery(TryImportFile, "Pick a Video", "video/*");
 }