コード例 #1
0
                public bool OnError(MediaPlayer mp, MediaError error, int extra)
                {
                    ProgressBar.Visibility = ViewStates.Gone;

                    // only show the resultView if we're active.
                    if (FragmentActive == true)
                    {
                        ResultView.Show(MessagesStrings.Error_Title,
                                        PrivateControlStylingConfig.Result_Symbol_Failed,
                                        MessagesStrings.Error_Watch_Playback,
                                        GeneralStrings.Retry);

                        ResultView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));
                    }

                    if (mp != null)
                    {
                        mp.Stop( );
                        mp.Reset( );
                    }

                    MediaControllerPrepared = false;

                    PlayerState = MediaPlayerState.None;

                    //SyncUI( );

                    return(true);
                }
コード例 #2
0
 public bool OnError(MediaPlayer mp, MediaError what, int extra)
 {
     Log.Error("AudioPlaybackService", "Playback error", what);
     RaiseEvent(MediaFailed);
     MediaPlayerState = MediaPlayerState.None;
     return(false);
 }
コード例 #3
0
        /**
         * \brief Callback for interface MediaPlayer.OnErrorListener
         * @param mediaPlayer
         * @param i error code
         * @param i1 error sub-code
         * @return true if the error is relative to this video player media player
         */
        public bool OnError(MediaPlayer mp, [GeneratedEnum] MediaError what, int extra)
        {
            if (mp == mMediaPlayer)
            {
                string errorDescription;
                switch (what)
                {
                case MediaError.NotValidForProgressivePlayback:
                    errorDescription = "The video is streamed and its container is not valid for progressive playback";
                    break;

                case MediaError.ServerDied:
                    errorDescription = "Media server died";
                    break;

                case MediaError.Unknown:
                    errorDescription = "Unspecified media player error";
                    break;

                default:
                    errorDescription = "Unknown error " + what;
                    break;
                }
                Log.Error("Pikkart AR Video", "Error while opening the file. Unloading the media player (" + errorDescription + ", " + extra + ")");
                unload();
                mVideoState = VIDEO_STATE.ERROR;
                return(true);
            }
            return(false);
        }
コード例 #4
0
 public void ReceiveError(MediaError mediaError)
 {
     if (OnError.HasDelegate)
     {
         OnError.InvokeAsync(mediaError);
     }
 }
コード例 #5
0
        public void ProcessResults_WithFailedResponse_IsProcessed()
        {
            var statProc = new MediaRequestProcessor <Media>
            {
                Type      = MediaType.Status,
                UploadUrl = BaseUrlAndVersion,
                MediaID   = 773000650376548356ul
            };

            List <Media> mediaList = statProc.ProcessResults(MediaStatusFailedResponse);

            Assert.IsNotNull(mediaList);
            Assert.AreEqual(1, mediaList.Count);
            Media media = mediaList.Single();

            Assert.IsNotNull(media);
            Assert.AreEqual(773000650376548356ul, media.MediaID);
            Assert.AreEqual(28276017, media.Size);
            Assert.IsNotNull(media.ProcessingInfo);
            MediaProcessingInfo info = media.ProcessingInfo;

            Assert.AreEqual(MediaProcessingInfo.Failed, info.State);
            Assert.AreEqual(100, info.ProgressPercent);
            Assert.IsNotNull(info.Error);
            MediaError error = info.Error;

            Assert.AreEqual(3, error.Code);
            Assert.AreEqual("UnsupportedMedia", error.Name);
            Assert.AreEqual("Duration 10.minutes+22.seconds+628.milliseconds exceeds max duration of 2.minutes+20.seconds", error.Message);
        }
コード例 #6
0
 public bool OnError(MediaPlayer mp, MediaError what, int extra)
 {
     Stop().Wait();
     Status = MediaPlayerStatus.Failed;
     OnMediaFailed(new MediaFailedEventArgs(what.ToString(), new System.Exception()));
     return(true);
 }
コード例 #7
0
        /**
         * \brief Callback for interface MediaPlayer.OnErrorListener
         * @param mediaPlayer
         * @param i error code
         * @param i1 error sub-code
         * @return true if the error is relative to this video player media player
         */
        public bool OnError(MediaPlayer mp, [GeneratedEnum] MediaError what, int extra)
        {
            if (mp == mMediaPlayer)
            {
                string errorDescription;
                switch (what)
                {
                case MediaError.NotValidForProgressivePlayback:
                    errorDescription = "The video is streamed and its container is not valid for progressive playback";
                    break;

                case MediaError.ServerDied:
                    errorDescription = "Media server died";
                    break;

                case MediaError.Unknown:
                    errorDescription = "Unspecified media player error";
                    break;

                default:
                    errorDescription = "Unknown error " + what;
                    break;
                }
                Log.Error("PikkartFullscreenVideo", "Error while opening the file for fullscreen. Unloading the media player (" + errorDescription + ", " + extra + ")");
                prepareForTermination();
                destroyMediaPlayer();
                Finish();
                return(true);
            }

            return(false);
        }
コード例 #8
0
        /// <summary>
        /// Creates the video player error event arguments.
        /// </summary>
        /// <param name="errorCode">The error code.</param>
        /// <param name="extra">The extra.</param>
        /// <returns>
        /// VideoPlayerErrorEventArgs with information populated.
        /// </returns>
        private EventArgsVideoPlayerError CreateVideoPlayerErrorEventArgs(MediaError errorCode)
        {
            var videoPlayerEventArgs = CreateVideoPlayerEventArgs();

            return(videoPlayerEventArgs == null
                ? new EventArgsVideoPlayerError(errorCode.ToString())
                : new EventArgsVideoPlayerError(videoPlayerEventArgs, errorCode.ToString(), null));
        }
コード例 #9
0
        public bool OnError(MediaPlayer mp, MediaError what, int extra)
        {
            LogHelper.Error(Tag, "Media player error: what=" + what + ", extra=" + extra);

            Callback?.OnError("MediaPlayer error " + what + " (" + extra + ")");

            return(true);
        }
コード例 #10
0
ファイル: LocalPlayback.cs プロジェクト: GrumpyTrev/DNLACore
        /// <summary>
        /// Called when the MediaPlayer has encounter an error condition
        /// </summary>
        /// <param name="mp"></param>
        /// <param name="what"></param>
        /// <param name="extra"></param>
        /// <returns></returns>
        public bool OnError(MediaPlayer _, [GeneratedEnum] MediaError what, int extra)
        {
            localPlayer.Reset();
            isPreparing = false;

            Logger.Error(string.Format("Error reported by MediaPlayer : {0} : {1}", what, extra));

            return(true);
        }
コード例 #11
0
        public bool OnError(MediaPlayer mp, MediaError what, int extra)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("Failed to play video, MediaError {0}", what.ToString()),
                                               "Droid.VideoPlayerRenderer");

            // this prevents a built-in alert popup
            // todo should we have an indicator to user
            return(true);
        }
コード例 #12
0
 public bool OnError(MediaPlayer mp, MediaError what, int extra)
 {
     Logger.Error("OnError: what=" + what + ", extra=" + extra);
     if (_musicService != null)
     {
         _musicService.OnError("MediaPlayer error " + what + "(" + extra + ")");
     }
     return(true);
 }
コード例 #13
0
 public bool OnError(MediaPlayer mp, [GeneratedEnum] MediaError what, int extra)
 {
     System.Diagnostics.Debug.WriteLine("OnError()");
     _playing = false;
     System.Diagnostics.Debug.WriteLine(what);
     mp.Reset();
     _isPlaying.Invoke(false);
     UpdatePlaybackState(PlaybackStateCompat.StatePaused);
     return(false);
 }
コード例 #14
0
        bool MediaPlayer.IOnErrorListener.OnError(MediaPlayer mp, MediaError what, int extra)
        {
            if (Controller == null)
            {
                return(false);
            }

            Controller.OnMediaFailed();
            return(false);
        }
コード例 #15
0
        public bool OnError(MediaPlayer mp, [GeneratedEnum] MediaError what, int extra)
        {
            try
            {
                mp.Start();
            }
            catch { }

            return(true);
        }
コード例 #16
0
ファイル: MediaDemos.cs プロジェクト: matt2323/LinqToTwitter
        static async Task CreateMetadataAsync(TwitterContext twitterCtx)
        {
            string status =
                "Testing video upload tweet #Linq2Twitter £ " +
                DateTime.Now.ToString(CultureInfo.InvariantCulture);

            byte[]      imageBytes       = File.ReadAllBytes(@"..\..\..\images\TwitterTest.mp4");
            const ulong JoeMayoUserID    = 15411837;
            var         additionalOwners = new ulong[] { JoeMayoUserID };
            string      mediaType        = "video/mp4";
            string      mediaCategory    = "tweet_video";

            Media media = await twitterCtx.UploadMediaAsync(imageBytes, mediaType, additionalOwners, mediaCategory);

            Media mediaStatusResponse = null;

            do
            {
                if (mediaStatusResponse != null)
                {
                    int checkAfterSeconds = mediaStatusResponse?.ProcessingInfo?.CheckAfterSeconds ?? 0;
                    Console.WriteLine($"Twitter video testing in progress - waiting {checkAfterSeconds} seconds.");
                    await Task.Delay(checkAfterSeconds * 1000);
                }

                mediaStatusResponse =
                    await
                        (from stat in twitterCtx.Media
                        where stat.Type == MediaType.Status &&
                        stat.MediaID == media.MediaID
                        select stat)
                    .SingleOrDefaultAsync();
            } while (mediaStatusResponse?.ProcessingInfo?.State == MediaProcessingInfo.InProgress);

            if (mediaStatusResponse?.ProcessingInfo?.State == MediaProcessingInfo.Succeeded)
            {
                await twitterCtx.CreateMediaMetadataAsync(mediaStatusResponse.MediaID, "LINQ to Twitter Alt Text Test");

                Status tweet = await twitterCtx.TweetAsync(status, new ulong[] { media.MediaID });

                if (tweet != null)
                {
                    Console.WriteLine($"Tweet sent: {tweet.Text}");
                }
            }
            else
            {
                MediaError error = mediaStatusResponse?.ProcessingInfo?.Error;

                if (error != null)
                {
                    Console.WriteLine($"Request failed - Code: {error.Code}, Name: {error.Name}, Message: {error.Message}");
                }
            }
        }
コード例 #17
0
        public bool OnError(MediaPlayer mp, MediaError what, int extra)
        {
            if (_player == null)
            {
                return(true);
            }

            _player.Release();
            _player = null;
            return(true);
        }
コード例 #18
0
ファイル: MediaPlayer.Android.cs プロジェクト: dpisanu/Uno
        public bool OnError(AndroidMediaPlayer mp, MediaError what, int extra)
        {
            if (PlaybackSession.PlaybackState != MediaPlaybackState.None)
            {
                _player?.Stop();
                PlaybackSession.PlaybackState = MediaPlaybackState.None;
            }

            OnMediaFailed(message: $"MediaPlayer Error: {what}");
            return(true);
        }
コード例 #19
0
        /// <summary>
        /// Called when [media error occurred].
        /// </summary>
        /// <param name="errorMessage">The error messaige.</param>
        /// <param name="ex">The ex.</param>
        internal void OnMediaErrorOccurred(string errorMessage, Exception ex = null)
        {
            MediaState = MediaState.Error;

            ErrorMessage = errorMessage;

            MediaError?.Invoke(this, new MediaErrorEventArgs {
                ErrorMessage = errorMessage, ErrorObject = ex, OriginalSource = VideoSource
            });

            OnMediaStateChanged();
        }
コード例 #20
0
 // Callback function to handle events
 public void OnMediaPlayerEvent(Media source, MediaEvent.Type type, MediaError error)
 {
     if (error == MediaError.NoError)
     {
         //Debug.Log("[RenderToIMGUIWithControls] Event: " + type.ToString());
         _events.Add(new EventEntry(type.ToString(), _eventDisplayTime));
     }
     else
     {
         //Debug.LogError("[RenderToIMGUIWithControls] Error: " + error.ToString());
         _events.Add(new EventEntry(type.ToString() + ": " + error.ToString(), _eventDisplayTime));
     }
 }
コード例 #21
0
                public bool OnError(MediaPlayer mp, MediaError error, int extra)
                {
                    ProgressBar.Visibility = ViewStates.Gone;

                    ResultView.Show(MessagesStrings.Error_Title,
                                    PrivateControlStylingConfig.Result_Symbol_Failed,
                                    MessagesStrings.Error_Watch_Playback,
                                    GeneralStrings.Retry);

                    ResultView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));

                    return(true);
                }
コード例 #22
0
        static async Task UploadVideoAsync(TwitterContext twitterCtx)
        {
            string status =
                "Testing video upload tweet #Linq2Twitter £ " +
                DateTime.Now.ToString(CultureInfo.InvariantCulture);

            //Media media = await twitterCtx.UploadMediaAsync(File.ReadAllBytes(@"..\..\images\LinqToTwitterNormalTest.mp4"), "video/mp4", "tweet_video");
            Media media = await twitterCtx.UploadMediaAsync(File.ReadAllBytes(@"..\..\images\LinqToTwitterMediumTest.mp4"), "video/mp4", "tweet_video");

            //Media media = await twitterCtx.UploadMediaAsync(File.ReadAllBytes(@"..\..\images\LinqToTwitterErrorTest.mp4"), "video/mp4", "tweet_video");

            Media mediaStatusResponse = null;

            do
            {
                if (mediaStatusResponse != null)
                {
                    int checkAfterSeconds = mediaStatusResponse?.ProcessingInfo?.CheckAfterSeconds ?? 0;
                    Console.WriteLine($"Twitter video testing in progress - waiting {checkAfterSeconds} seconds.");
                    await Task.Delay(checkAfterSeconds * 1000);
                }

                mediaStatusResponse =
                    await
                        (from stat in twitterCtx.Media
                        where stat.Type == MediaType.Status &&
                        stat.MediaID == media.MediaID
                        select stat)
                    .SingleOrDefaultAsync();
            } while (mediaStatusResponse?.ProcessingInfo?.State == MediaProcessingInfo.InProgress);

            if (mediaStatusResponse?.ProcessingInfo?.State == MediaProcessingInfo.Succeeded)
            {
                Status tweet = await twitterCtx.TweetAsync(status, new ulong[] { media.MediaID });

                if (tweet != null)
                {
                    Console.WriteLine($"Tweet sent: {tweet.Text}");
                }
            }
            else
            {
                MediaError error = mediaStatusResponse?.ProcessingInfo?.Error;

                if (error != null)
                {
                    Console.WriteLine($"Request failed - Code: {error.Code}, Name: {error.Name}, Message: {error.Message}");
                }
            }
        }
コード例 #23
0
        // Callback function to handle media events
        private void OnMediaPlayerEvent(Media media, MediaEvent.Type et, MediaError errorCode)
        {
            switch (et)
            {
            case MediaEvent.Type.PlaybackStarted:
            case MediaEvent.Type.PlaybackResumed:
                ApplyAudioSettings(media, _audioSource);
                _audioSource.Play();
                break;

            case MediaEvent.Type.Closed:
                _audioSource.Stop();
                break;
            }
        }
コード例 #24
0
        public async Task <string> TweetAsync(string message, byte[] mediaByteArray, string extension, string mediaType)
        {
            string response = "";
            string status   = message;

            Media media = await twitterContext.UploadMediaAsync(mediaByteArray, extension, mediaType);

            Media mediaStatusResponse = null;

            do
            {
                if (mediaStatusResponse != null)
                {
                    int checkAfterSeconds = mediaStatusResponse?.ProcessingInfo?.CheckAfterSeconds ?? 0;
                    Console.WriteLine($"Twitter video testing in progress - waiting {checkAfterSeconds} seconds.");
                    await Task.Delay(checkAfterSeconds * 1000);
                }

                mediaStatusResponse =
                    await
                        (from stat in twitterContext.Media
                        where stat.MediaID == media.MediaID && stat.Type == MediaType.Status
                        select stat) // stat.Type == MediaType.Status &&
                    //       stat.MediaID == media.MediaID
                    // select stat)
                    .SingleOrDefaultAsync();
            } while (mediaStatusResponse?.ProcessingInfo?.State == MediaProcessingInfo.InProgress);

            if (mediaStatusResponse?.ProcessingInfo?.State == MediaProcessingInfo.Succeeded)
            {
                Status tweet = await twitterContext.TweetAsync(status, new ulong[] { media.MediaID });

                if (tweet != null)
                {
                    return(tweet.Text.Substring(tweet.Text.LastIndexOf("https:")));
                }
            }
            else
            {
                MediaError error = mediaStatusResponse?.ProcessingInfo?.Error;

                if (error != null)
                {
                    response = $"Request failed - Code: {error.Code}, Name: {error.Name}, Message: {error.Message}";
                }
            }
            return(response);
        }
コード例 #25
0
            bool MediaPlayer.IOnErrorListener.OnError
            (
                MediaPlayer mediaPlayer,
                MediaError what,
                int extra
            )
            {
                string errorFormat  = _getString(Resource.String.VideoErrorFormat);
                string errorMessage = string.Format(errorFormat,
                                                    _videoPath);

                Toast.MakeText
                (
                    _videoContext,
                    errorMessage,
                    ToastLength.Long
                )
                .Show();

                return(false);
            }
コード例 #26
0
        public bool OnError(MediaPlayer mp, MediaError error, int what)
        {
            String msg = "";

            if (error == MediaError.TimedOut)
            {
                msg = GetString(Resource.String.video_error_media_load_timeout);
            }
            else if (error == MediaError.ServerDied)
            {
                msg = GetString(Resource.String.video_error_server_unaccessible);
            }
            else
            {
                msg = GetString(Resource.String.video_error_unknown_error);
            }
            Utils.ShowErrorDialog(this, msg);
            mVideoView.StopPlayback();
            mPlaybackState = PlaybackState.IDLE;
            return(false);
        }
コード例 #27
0
ファイル: Media.cs プロジェクト: zhouy546/bikeHapVideo
        private void PopulateErrors()
        {
            MediaError error = NativeDll.GetError(_mediaId);

            if (error != MediaError.NoError)
            {
                if (_opening)
                {
                    ResetCachedProperties();

                    InvokeEvent(MediaEvent.Type.OpenFailed, error);
                    _opening = false;

                    Debug.LogError("[DemolitionMedia] OpenFailed: " + error.ToString());
                }
                else
                {
                    InvokeEvent(MediaEvent.Type.PlaybackErrorOccured, error);

                    Debug.LogError("[DemolitionMedia] PlaybackErrorOccured: " + error.ToString());
                }
            }
        }
コード例 #28
0
 public bool OnError(MediaPlayer mp, MediaError what, int extra)
 {
     SessionManager.UpdatePlaybackState(PlaybackStateCompat.StateError, Position.Seconds, Enum.GetName(typeof(MediaError),what));
     Stop();
     return true;
 }
コード例 #29
0
 public bool OnError(MediaPlayer mp, MediaError what, int extra)
 {
     SessionManager.UpdatePlaybackState(PlaybackStateCompat.StateError, Position.Seconds, Enum.GetName(typeof(MediaError), what));
     Stop();
     return(true);
 }
コード例 #30
0
		public bool OnError (MediaPlayer mp, MediaError what, int extra)
		{
			LogHelper.Error (Tag, "Media player error: what=" + what + ", extra=" + extra);
			if (Callback != null) {
				Callback.OnError ("MediaPlayer error " + what + " (" + extra + ")");
			}
			return true;
		}
コード例 #31
0
 public bool OnError(MediaPlayer mp, MediaError what, int extra)
 {
     System.Diagnostics.Debug.WriteLine("MediaPlayer on ErrorListener");
     return true;
 }
コード例 #32
0
		public bool OnError (MediaPlayer mp, MediaError what, int extra)
		{
			return false;
		}
コード例 #33
0
                public bool OnError( MediaPlayer mp, MediaError error, int extra )
                {
                    ProgressBar.Visibility = ViewStates.Gone;

                    // only show the resultView if we're active.
                    if( FragmentActive == true )
                    {
                        ResultView.Show( MessagesStrings.Error_Title, 
                            PrivateControlStylingConfig.Result_Symbol_Failed, 
                            MessagesStrings.Error_Watch_Playback,
                            GeneralStrings.Retry );
                        
                        ResultView.SetBounds( new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ) );
                    }

                    if( mp != null )
                    {
                        mp.Stop( );
                        mp.Reset( );
                    }

                    MediaControllerPrepared = false;

                    PlayerState = MediaPlayerState.None;

                    //SyncUI( );

                    return true;
                }
コード例 #34
0
 public bool OnError(MediaPlayer mp, MediaError what, int extra)
 {
     HandleError();
     return(true);
 }
コード例 #35
0
        public bool OnError (MediaPlayer mp, MediaError what, int extra)
        {
            
            UpdatePlaybackState(PlaybackStateCompat.StateError);
			Stop ();
            return true;
        }
コード例 #36
0
ファイル: LocalService.cs プロジェクト: dorisoy/Wesley
 public bool OnError(MediaPlayer mp, [GeneratedEnum] MediaError what, int extra)
 {
     return(false);
 }
コード例 #37
0
 public bool OnError(MediaPlayer mp, MediaError what, int extra)
 {
     Stop();
     Status = MediaPlayerStatus.Failed;
     return true;
 }
コード例 #38
0
                public bool OnError( MediaPlayer mp, MediaError error, int extra )
                {
                    ProgressBar.Visibility = ViewStates.Gone;

                    ResultView.Show( MessagesStrings.Error_Title, 
                        PrivateControlStylingConfig.Result_Symbol_Failed, 
                        MessagesStrings.Error_Watch_Playback,
                        GeneralStrings.Retry );

                    ResultView.SetBounds( new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ) );

                    return true;
                }
コード例 #39
0
 public bool OnError(MediaPlayer mp, MediaError what, int extra)
 {
     Log.Error("AudioPlaybackService", "Playback error", what);
     RaiseEvent(MediaFailed);
     MediaPlayerState = MediaPlayerState.None;
     return false;
 }
コード例 #40
0
        public bool OnError(MediaPlayer mp, MediaError what, int extra)
        {
			Stop().Wait();
            Status = MediaPlayerStatus.Failed;
			OnMediaFailed(new MediaFailedEventArgs(what.ToString(), new System.Exception()));
            return true;
        }
コード例 #41
0
		public bool OnError(MediaPlayer mp, MediaError error, int what){
			String msg = "";
			if (error == MediaError.TimedOut) {
				msg = GetString (Resource.String.video_error_media_load_timeout);
			} else if (error == MediaError.ServerDied) {
				msg = GetString (Resource.String.video_error_server_unaccessible);
			} else {
				msg = GetString (Resource.String.video_error_unknown_error);
			}
			Utils.ShowErrorDialog (this, msg);
			mVideoView.StopPlayback ();
			mPlaybackState = PlaybackState.IDLE;
			return false;
		}