Exemple #1
0
 internal override void OnBeginPlayback(PlayerInterop playbackWrapper)
 {
     base.OnBeginPlayback(playbackWrapper);
     this._hasReportedStreamPlayback = false;
     this._hasReportedStreamPlaySkip = false;
     Microsoft.Zune.Util.Notification.BroadcastNowPlaying(EMediaTypes.eMediaTypeAudio, this.Album, this.Artist, this.Title, this.TrackNumber, this.ZuneMediaId);
 }
        internal override void OnBeginPlayback(PlayerInterop playbackWrapper)
        {
            base.OnBeginPlayback(playbackWrapper);
            this._hasMarkedPlayed         = false;
            this._markPlayedAt            = 0L;
            this._hasIncrementedPlayCount = false;
            this._hasIncrementedSkipCount = false;
            this._lastStoredBookmark      = 0L;
            this._duration = playbackWrapper.Duration;
            if (this._mediaType == ZuneUI.MediaType.PodcastEpisode || this._mediaType == ZuneUI.MediaType.Video)
            {
                PodcastVideoLengthGroup videoLengthGroup = PodcastVideoLengthGroup.Long;
                while (videoLengthGroup > PodcastVideoLengthGroup.Short && this._duration <= c_podcastVideoLengths[(int)videoLengthGroup])
                {
                    --videoLengthGroup;
                }
                this._markPlayedAt = this._duration - c_podcastVideoMarkPlayedAtEOFMinus[(int)videoLengthGroup];
                if (this._markPlayedAt < 1L)
                {
                    this._markPlayedAt = 1L;
                }
                this._lastStoredBookmark = this.Bookmark;
                if (this._lastStoredBookmark != 0L)
                {
                    playbackWrapper.SeekToAbsolutePosition(this._lastStoredBookmark);
                    if (this._lastStoredBookmark > 200000000L)
                    {
                        this._hasIncrementedPlayCount = true;
                    }
                }
                if (this._mediaType == ZuneUI.MediaType.PodcastEpisode)
                {
                    if (this.IsVideo)
                    {
                        SQMLog.Log(SQMDataId.PodcastVideoEpisodePlayed, 1);
                    }
                    else
                    {
                        SQMLog.Log(SQMDataId.PodcastAudioEpisodePlayed, 1);
                    }
                }
            }
            EMediaTypes MediaType;

            switch (this.MediaType)
            {
            case ZuneUI.MediaType.Track:
                MediaType = EMediaTypes.eMediaTypeAudio;
                break;

            case ZuneUI.MediaType.Video:
                MediaType = EMediaTypes.eMediaTypeVideo;
                break;

            case ZuneUI.MediaType.PodcastEpisode:
                MediaType = EMediaTypes.eMediaTypePodcastEpisode;
                break;

            default:
                MediaType = EMediaTypes.eMediaTypeInvalid;
                break;
            }
            Microsoft.Zune.Util.Notification.BroadcastNowPlaying(MediaType, this.Album, this.DisplayArtist, this.Title, this.TrackNumber, this.ZuneMediaId);
        }