コード例 #1
0
 /// <summary>
 /// Callback for response to seek() device method.
 /// </summary>
 public override void onSeek(SmcAvPlayer device, long requestedPosition, int err)
 {
     if (err != Smc.SUCCESS)
     {
         // Error has occurred.
         return;
     }
     // Action successful, no further processing needed.
 }
コード例 #2
0
        /// <summary>
        /// Callback when AllShare device state changes
        /// </summary>
        public override void onDeviceChanged(SmcAvPlayer device, int state, int err)
        {
            Log.d("MusicPlayer", "onDeviceChanged: " + state);

            if (err != Smc.SUCCESS)
            {
                // Error has occurred, switch to local player.
                mController.setLocalPlayer();
                return;
            }

            // We use simplified state set, so map from states used in service
            // to states used locally.
            switch (state)
            {
            case SmcAvPlayer.STATE_PAUSED:
                State = PlayerState.PAUSED;
                break;

            case SmcAvPlayer.STATE_PLAYING:
                State = PlayerState.PLAYING;
                if (mFirstPlay)
                {
                    mPlayer.seek(mPosition);
                    mFirstPlay = false;
                }

                mPosition = 0;

                break;

            case SmcAvPlayer.STATE_BUFFERING:
                State = PlayerState.BUFFERING;
                break;

            case SmcAvPlayer.STATE_STOPPED:
                if (mCurrentState == PlayerState.INITIALIZING)
                {
                    playItem();
                }
                else
                {
                    State = PlayerState.STOPPED;
                }
                break;

            case SmcAvPlayer.STATE_CONTENT_CHANGED:
                //mController.setLocalPlayer();
                //TODO
                break;

            default:
                State = PlayerState.STOPPED;
                break;
            }
        }
コード例 #3
0
        /// <summary>
        /// Callback for response to pause() device method.
        /// </summary>
        public override void onPause(SmcAvPlayer device, int err)
        {
            if (err != Smc.SUCCESS)
            {
                // Error has occurred.
                return;
            }

            // Notify controller of state change.
            State = PlayerState.PAUSED;
        }
コード例 #4
0
        /// <summary>
        /// Callback for response to play() device method.
        /// </summary>
        public override void onPlay(SmcAvPlayer device, SmcItem item, SmcAvPlayer.PlayInfo contentInfo, int error)
        {
            if (error != Smc.SUCCESS)
            {
                // Error has occurred.
                return;
            }

            // Notify controller of state change.
            State = PlayerState.PLAYING;
        }
コード例 #5
0
        /// <summary>
        /// Callback for response to resume() device method.
        /// </summary>
        public override void onResume(SmcAvPlayer device, int error)
        {
            if (error != Smc.SUCCESS)
            {
                // Error has occurred.
                return;
            }

            // Notify controller of state change
            State = PlayerState.PLAYING;
        }
コード例 #6
0
        /// <summary>
        /// Callback for response to hide() device method.
        /// </summary>
        public override void onStop(SmcAvPlayer device, int error)
        {
            if (error != Smc.SUCCESS)
            {
                // Error has occurred.
                return;
            }

            // Notify controller of state change
            mController.notifyCurrentPosition(0);
            State     = PlayerState.STOPPED;
            mPosition = 0;
        }
コード例 #7
0
 /// <summary>
 /// Callback for response to requestPlayPosition() device method.
 /// </summary>
 public override void onRequestPlayPosition(SmcAvPlayer device, long position, int err)
 {
     if (err != Smc.SUCCESS)
     {
         // Error has occurred.
         return;
     }
     // Notify controller of current position.
     if (position != 0)
     {
         mController.notifyCurrentPosition((int)position);
     }
     if (Math.Abs(position - mPosition) < 2 && mCurrentState == PlayerState.BUFFERING)
     {
         State = PlayerState.PLAYING;
     }
 }
コード例 #8
0
        /////////////////////////////////////////////////////////////////////////////////
        // SmcDeviceFinder.StatusListener implementation
        /////////////////////////////////////////////////////////////////////////////////

        public override void onStarted(SmcDeviceFinder deviceFinder, int error)
        {
            mDeviceFinder = deviceFinder;
            mPlayer       = (SmcAvPlayer)mDeviceFinder.getDevice(mDeviceType, mDeviceId);
            if (mPlayer == null)
            {
                mController.setLocalPlayer();
                return;
            }

            if (mController.CurrentState != PlayerState.STOPPED)
            {
                registerListeners();
            }

            mPlayer.requestVolumeInfo();
            mPlayer.requestStateInfo();
            mPlayer.requestMuteInfo();
        }
コード例 #9
0
 public override void onRequestVolumeInfo(SmcAvPlayer device, int i, int error)
 {
     mController.notifyCurrentVolume(i);
 }
コード例 #10
0
		/// <summary>
		/// Callback for response to requestPlayPosition() device method.
		/// </summary>
		public override void onRequestPlayPosition(SmcAvPlayer device, long position, int err)
		{
			if (err != Smc.SUCCESS)
			{
				// Error has occurred.
				return;
			}
			// Notify controller of current position.
			if (position != 0)
			{
				mController.notifyCurrentPosition((int) position);
			}
			if (Math.Abs(position - mPosition) < 2 && mCurrentState == PlayerState.BUFFERING)
			{
				State = PlayerState.PLAYING;
			}
		}
コード例 #11
0
		public override void onRequestMediaInfo(SmcAvPlayer device, SmcAvPlayer.MediaInfo mediaInfo, int err)
		{
			// Not used in this sample.
		}
コード例 #12
0
		/// <summary>
		/// Callback for response to pause() device method.
		/// </summary>
		public override void onPause(SmcAvPlayer device, int err)
		{
			if (err != Smc.SUCCESS)
			{
				// Error has occurred.
				return;
			}

			// Notify controller of state change.
			State = PlayerState.PAUSED;
		}
コード例 #13
0
		public override void onRequestStateInfo(SmcAvPlayer device, int state, int err)
		{
			onDeviceChanged(device, state, err);
		}
コード例 #14
0
 public override void onSetMute(SmcAvPlayer device, bool onOff, int error)
 {
 }
コード例 #15
0
		/// <summary>
		/// Callback for response to hide() device method.
		/// </summary>
		public override void onStop(SmcAvPlayer device, int error)
		{
			if (error != Smc.SUCCESS)
			{
				// Error has occurred.
				return;
			}

			// Notify controller of state change
			mController.notifyCurrentPosition(0);
			State = PlayerState.STOPPED;
			mPosition = 0;
		}
コード例 #16
0
 public override void onRequestMediaInfo(SmcAvPlayer device, SmcAvPlayer.MediaInfo mediaInfo, int err)
 {
     // Not used in this sample.
 }
コード例 #17
0
		/// <summary>
		/// Callback for response to resume() device method.
		/// </summary>
		public override void onResume(SmcAvPlayer device, int error)
		{
			if (error != Smc.SUCCESS)
			{
				// Error has occurred.
				return;
			}

			// Notify controller of state change
			State = PlayerState.PLAYING;
		}
コード例 #18
0
		public override void onSetMute(SmcAvPlayer device, bool onOff, int error)
		{
		}
コード例 #19
0
		/// <summary>
		/// Callback for AllShare device state changes.
		/// </summary>
		public override void onDeviceChanged(SmcAvPlayer device, int state, int error)
		{
			Log.d("VideoPlayer", "onDeviceChanged: " + state);

			if (error != Smc.SUCCESS)
			{
				// Error has occurred, switch to local player.
				mController.setLocalPlayer();
				return;
			}

			// We use simplified state set, so map from states used in service
			// to states used locally.
			switch (state)
			{
				case SmcAvPlayer.STATE_PAUSED:
					State = PlayerState.PAUSED;
					break;
				case SmcAvPlayer.STATE_PLAYING:
					State = PlayerState.PLAYING;
					if (mFirstPlay)
					{
						mPlayer.seek(mPosition);
						mFirstPlay = false;
					}
					mPosition = 0;
					break;
				case SmcAvPlayer.STATE_BUFFERING:
					State = PlayerState.BUFFERING;
					break;
				case SmcAvPlayer.STATE_STOPPED:
					if (mCurrentState == PlayerState.INITIALIZING)
					{
						playItem();
					}
					else
					{
						State = PlayerState.STOPPED;
					}
					break;
				case SmcAvPlayer.STATE_CONTENT_CHANGED:
					//mController.setLocalPlayer();
					break;
				default:
					State = PlayerState.STOPPED;
				break;
			}
		}
コード例 #20
0
		public override void onSetVolume(SmcAvPlayer device, int level, int error)
		{
		}
コード例 #21
0
		public override void onRequestMuteInfo(SmcAvPlayer device, bool b, int error)
		{

		}
コード例 #22
0
		public override void onRequestVolumeInfo(SmcAvPlayer device, int i, int error)
		{
			mController.notifyCurrentVolume(i);
		}
コード例 #23
0
 public override void onRequestMuteInfo(SmcAvPlayer device, bool b, int error)
 {
 }
コード例 #24
0
 public override void onRequestStateInfo(SmcAvPlayer device, int state, int err)
 {
     onDeviceChanged(device, state, err);
 }
コード例 #25
0
 public override void onSetVolume(SmcAvPlayer device, int level, int error)
 {
 }
コード例 #26
0
		/// <summary>
		/// Callback for response to play() device method.
		/// </summary>
		public override void onPlay(SmcAvPlayer device, SmcItem item, SmcAvPlayer.PlayInfo contentInfo, int error)
		{
			if (error != Smc.SUCCESS)
			{
				// Error has occurred.
				return;
			}

			// Notify controller of state change.
			State = PlayerState.PLAYING;
		}
コード例 #27
0
		/////////////////////////////////////////////////////////////////////////////////
		// SmcDeviceFinder.StatusListener implementation
		/////////////////////////////////////////////////////////////////////////////////

		public override void onStarted(SmcDeviceFinder deviceFinder, int error)
		{
			mDeviceFinder = deviceFinder;
			mPlayer = (SmcAvPlayer) mDeviceFinder.getDevice(mDeviceType, mDeviceId);
			if (mPlayer == null)
			{
				mController.setLocalPlayer();
				return;
			}

			if (mController.CurrentState != PlayerState.STOPPED)
			{
				registerListeners();
			}

			mPlayer.requestVolumeInfo();
			mPlayer.requestStateInfo();
			mPlayer.requestMuteInfo();
		}
コード例 #28
0
		/// <summary>
		/// Callback for response to seek() device method.
		/// </summary>
		public override void onSeek(SmcAvPlayer device, long requestedPosition, int err)
		{
			if (err != Smc.SUCCESS)
			{
				// Error has occurred.
				return;
			}
			// Action successful, no further processing needed.
		}