Esempio n. 1
0
        public static void ActivityResult(int requestCode, Result resultCode, Intent data)
        {
            if (_callback == null)
            {
                return;
            }
            if (resultCode == Result.Ok)
            {
                if (requestCode == RequestCodes.RecordVideo)
                {
                    _callback(_destFile.Path);
                }

                else if (requestCode == RequestCodes.CompressVideo)
                {
                }
                else if (requestCode == RequestCodes.SelectVideo)
                {
                    var destFilePath = ImageFilePath.GetPath(CurrentActivity, data.Data);
                    _callback(destFilePath);
                }

                else if (requestCode == RequestCodes.PlayVideo)
                {
                    _callback(null);
                }
            }
        }
Esempio n. 2
0
        public static void HandleActivity(int requestCode, Result resultCode, Intent data)
        {
            isBusy = false;
            if (requestCode == IntentHelper.RequestCodes.SelectVideo)
            {
                if (resultCode == Result.Ok)
                {
                    var path = ImageFilePath.GetPath(Forms.Context, data.Data);
                    if (!System.IO.File.Exists(path))
                    {
                        Toast.MakeText(Forms.Context, "Invalid file source", ToastLength.Long).Show();
                        _tcsVideo.SetResult(null);
                        return;
                    }
                    ////get duration
                    //MediaMetadataRetriever retriever = new MediaMetadataRetriever();
                    //retriever.SetDataSource(path);
                    //string time = retriever.ExtractMetadata(MetadataKey.Duration);
                    //long duration = Java.Lang.Long.ParseLong(time);

                    //if (duration / 1000 <= 45)
                    //    _tcsVideo.SetResult(path);
                    //else
                    //{
                    //    //Toast.MakeText(Forms.Context, "Please select video less than 30 seconds", ToastLength.Long).Show();
                    //    _tcsVideo.SetResult(App.VideoDurationCheckMessage);
                    //}
                }
                else
                {
                    _tcsVideo.SetResult(null);
                }
            }
        }