Пример #1
0
        public Service(MediaElement mediaElement)
        {
            //player.Source = playlist;

            // Initialize the alljoyn bus
            bus = new AllJoynBusAttachment();
            bus.AboutData.IsEnabled           = true;
            bus.AboutData.DefaultAppName      = Windows.ApplicationModel.Package.Current.DisplayName;
            bus.AboutData.DefaultManufacturer = Windows.ApplicationModel.Package.Current.PublisherDisplayName;
            bus.AboutData.DefaultDescription  = "AllPlay Player Runtime"; // Windows.ApplicationModel.Package.Current.Description;
            bus.AboutData.ModelNumber         = "1";
            var version = Windows.ApplicationModel.Package.Current.Id.Version;

            bus.AboutData.SoftwareVersion = string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
            bus.AboutData.SupportUrl      = new Uri("https://github.com/dotMorten/AllPlayMediaPlayer/Issues");

            // Initialize up the producers
            allplayProducer       = new net.allplay.AllPlayProducer(bus);
            mediaProducer         = allplayProducer.MediaPlayer;
            mediaProducer.Service = this;
            volume               = allplayProducer.Volume;
            volume.Service       = this;
            mcuProducer          = allplayProducer.MCU;
            mcuProducer.Service  = this;
            zoneProducer         = allplayProducer.ZoneManager;
            zoneProducer.Service = this;

#if DEBUG
            allplayProducer.Stopped              += AllplayProducer_Stopped;
            allplayProducer.SessionLost          += AllplayProducer_SessionLost;
            allplayProducer.SessionMemberAdded   += AllplayProducer_SessionMemberAdded;
            allplayProducer.SessionMemberRemoved += AllplayProducer_SessionMemberRemoved;
#endif

            player = mediaElement;
            Playlist.CurrentItemChanged += Playlist_CurrentItemChanged;
            Playlist.ShuffleModeChanged += Playlist_ShuffleModeChanged;
            Playlist.RepeatModeChanged  += Playlist_RepeatModeChanged;

            Playlist.LoadFromCache();
#if DEBUG
            if (Playlist.Items.Count == 0)
            {
                LoadSamplePlaylist();
            }
#endif
        }
Пример #2
0
 private void AllplayProducer_SessionLost(net.allplay.AllPlayProducer sender, AllJoynSessionLostEventArgs args)
 {
     System.Diagnostics.Debug.WriteLine($"IMediaPlayerService.Session Lost: {args.Reason}");
 }
Пример #3
0
 private void AllplayProducer_SessionMemberRemoved(net.allplay.AllPlayProducer sender, AllJoynSessionMemberRemovedEventArgs args)
 {
     System.Diagnostics.Debug.WriteLine($"IMediaPlayerService.Session Member Removed: {args.UniqueName}");
 }
Пример #4
0
 private void AllplayProducer_Stopped(net.allplay.AllPlayProducer sender, AllJoynProducerStoppedEventArgs args)
 {
     System.Diagnostics.Debug.WriteLine($"IMediaPlayerService.Producer stopped: {args.Status}");
 }