当前位置: 首页>>代码示例>>C#>>正文


C# Player.g_Player类代码示例

本文整理汇总了C#中MediaPortal.Player.g_Player的典型用法代码示例。如果您正苦于以下问题:C# g_Player类的具体用法?C# g_Player怎么用?C# g_Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


g_Player类属于MediaPortal.Player命名空间,在下文中一共展示了g_Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: g_Player_PlayBackStopped

 static void g_Player_PlayBackStopped(g_Player.MediaType type, int stoptime, string filename)
 {
   if (type == g_Player.MediaType.TV)
   {
     SetNewChannel(-1);
   }
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:7,代码来源:TvTimeShiftPositionWatcher.cs

示例2: Create

        public IPlayer Create(string filename, g_Player.MediaType type)
        {
			// hack to get around the MP 1.3 Alpha bug with non http URLs
            /*if (filename != PreparedUrl)
                throw new OnlineVideosException("Cannot play a different url than this PlayerFactory was created with!");
            else*/
                return PreparedPlayer;
        }              
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:8,代码来源:PlayerFactory.cs

示例3: Create

 public IPlayer Create(string filename, g_Player.MediaType type)
 {
     /*
     if (filename != PreparedUrl)
         throw new OnlineVideosException("Cannot play a different url than this PlayerFactory was created with!");
     else
        */
         return PreparedPlayer;
 }
开发者ID:pilehave,项目名称:headweb-mp,代码行数:9,代码来源:PlayerFactory.cs

示例4: OnVideoEnded

    /// <summary>
    /// Handles the g_Player.PlayBackEnded event
    /// </summary>
    /// <param name="type"></param>
    /// <param name="s"></param>
    public void OnVideoEnded(g_Player.MediaType type, string s)
    {
      // do not handle e.g. visualization window, last.fm player, etc
      if (type == g_Player.MediaType.Music)
      {
        return;
      }

      if (currentSettings.verboseLog)
      {
        Log.Debug("ViewModeSwitcher: On Video Ended");
      }
      LastSwitchedAspectRatio = 0f;
      isPlaying = false;
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:20,代码来源:ViewModeSwitcher.cs

示例5: OnPlayBackStarted

    private void OnPlayBackStarted(g_Player.MediaType type, string filename)
    {
      try
      {
        if (type == g_Player.MediaType.Music || Util.Utils.IsLastFMStream(filename))
        {
          Thread stateThread = new Thread(new ParameterizedThreadStart(PlaybackStartedThread));
          stateThread.IsBackground = true;
          stateThread.Name = "Scrobbler event";
          stateThread.Start((object)filename);

          Thread LoadThread = new Thread(new ThreadStart(OnSongLoadedThread));
          LoadThread.IsBackground = true;
          LoadThread.Name = "Scrobbler loader";
          LoadThread.Start();
        }
      }
      catch (Exception ex)
      {
        Log.Error("Audioscrobbler plugin: Error creating threads on playback start - {0}", ex.Message);
      }
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:22,代码来源:AudioscrobblerPlugin.cs

示例6: OnPlayBackStarted

    private void OnPlayBackStarted(g_Player.MediaType type, string filename)
    {
      // when we are watching TV and suddenly decides to watch a audio/video etc., we want to make sure that the TV is stopped on server.
      GUIWindow currentWindow = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow);

      if (type == g_Player.MediaType.Radio || type == g_Player.MediaType.TV)
      {
        UpdateGUIonPlaybackStateChange(true);
      }

      if (currentWindow.IsTv && type == g_Player.MediaType.TV)
      {
        return;
      }
      if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_RADIO || GUIWindowManager.ActiveWindow == (int)Window.WINDOW_RADIO_GUIDE)
      {
        return;
      }

      //gemx: fix for 0001181: Videoplayback does not work if tvservice.exe is not running
      bool isTS = (Card != null && Card.IsTimeShifting);
      if (Connected && isTS)
      {
        Card.StopTimeShifting();
      }
    }
开发者ID:splatterpop,项目名称:MediaPortal-1,代码行数:26,代码来源:TVHome.cs

示例7: Create

 public IPlayer Create(string fileName, g_Player.MediaType type)
 {
   IPlayer newPlayer = null;
   try
   {
     g_Player.MediaType? paramType = type as g_Player.MediaType?;
     if (paramType.HasValue)
     {
       newPlayer = Create(fileName, paramType);
     }
     else
     {
       newPlayer = Create(fileName, null);
     }
   }
   catch (Exception ex)
   {
     Log.Error("PlayerFactory: Error creating player instance - {0}", ex.Message);
     newPlayer = Create(fileName, null);
   }
   return newPlayer;
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:22,代码来源:PlayerFactory.cs

示例8: onPlaybackStarted

        private void onPlaybackStarted(g_Player.MediaType type, string filename)
        {
            if (_playerState == MoviePlayerState.Processing && g_Player.Player.Playing) {
                logger.Info("Playback Started: Internal, File={0}", filename);

                // get the duration of the media
                updateMediaDuration(queuedMedia);

                // get the movie
                DBMovieInfo movie = queuedMedia.AttachedMovies[0];

                // and jump to our resume position if necessary
                if (_resumeActive) {
                  if (g_Player.IsDVD && !movie.LocalMedia[0].IsBluray) {
                        logger.Debug("Resume: DVD state.");
                        g_Player.Player.SetResumeState(movie.ActiveUserSettings.ResumeData.Data);
                    }
                    else {
                        logger.Debug("Resume: Time={0}", movie.ActiveUserSettings.ResumeTime);
                        GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SEEK_POSITION, 0, 0, 0, 0, 0, null);
                        msg.Param1 = movie.ActiveUserSettings.ResumeTime;
                        GUIGraphicsContext.SendMessage(msg);
                    }
                    // deactivate resume and force play
                    _resumeActive = false;
                    _forcePlay = false;
                }

                // Trigger Movie started
                onMediaStarted(queuedMedia);
            }
        }
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:32,代码来源:MoviePlayer.cs

示例9: DoOnStarted

    private void DoOnStarted(g_Player.MediaType type, string filename)
    {
      Log.Debug("GUIMusicPlayingNow: g_Player_PlayBackStarted for {0}", filename);

      ImagePathContainer.Clear();
      CurrentTrackFileName = filename;
      GetTrackTags();

      CurrentThumbFileName = GUIMusicBaseWindow.GetCoverArt(false, CurrentTrackFileName, CurrentTrackTag);

      if (string.IsNullOrEmpty(CurrentThumbFileName))
        // no LOCAL Thumb found because user has bad settings -> check if there is a folder.jpg in the share
      {
        CurrentThumbFileName = Util.Utils.GetFolderThumb(CurrentTrackFileName);
        if (!Util.Utils.FileExistsInCache(CurrentThumbFileName))
        {
          CurrentThumbFileName = string.Empty;
        }
      }

      if (!string.IsNullOrEmpty(CurrentThumbFileName))
      {
        // let us test if there is a larger cover art image
        string strLarge = Util.Utils.ConvertToLargeCoverArt(CurrentThumbFileName);
        if (Util.Utils.FileExistsInCache(strLarge))
        {
          CurrentThumbFileName = strLarge;
        }
        AddImageToImagePathContainer(CurrentThumbFileName);
      }

      UpdateImagePathContainer();
      UpdateTrackInfo();

      // Do last.fm updates
      if (g_Player.IsMusic && _lookupSimilarTracks && g_Player.CurrentPosition >= 10.0 && lstSimilarTracks.Count == 0)
      {
        Log.Debug("GUIMusicPlayingNow: Do Last.FM lookup for similar trracks");
        UpdateSimilarTracks(CurrentTrackFileName);
      }


    }
开发者ID:cmendozac,项目名称:MediaPortal-1,代码行数:43,代码来源:GUIMusicPlayingNow.cs

示例10: OnPlayBackStopped

    private void OnPlayBackStopped(g_Player.MediaType type, int stoptime, string filename)
    {
      if (!ControlsInitialized || type != g_Player.MediaType.Music)
      {
        return;
      }

      if (GUIWindowManager.ActiveWindow == GetID && !_isStopped)
      {
        _isStopped = true;
        Log.Debug("GUIMusicPlayingNow: g_Player_PlayBackStopped for {0} - stoptime: {1}", filename, stoptime);
        Action action = new Action();
        action.wID = Action.ActionType.ACTION_PREVIOUS_MENU;
        GUIGraphicsContext.OnAction(action);
      }
    }
开发者ID:cmendozac,项目名称:MediaPortal-1,代码行数:16,代码来源:GUIMusicPlayingNow.cs

示例11: OnlineVideosPlayer

 public OnlineVideosPlayer(g_Player.MediaType type)
     : base(type)
 { }
开发者ID:offbyoneBB,项目名称:mp-onlinevideos2,代码行数:3,代码来源:OnlineVideosPlayer.cs

示例12: g_Player_PlayBackEnded

        void g_Player_PlayBackEnded(g_Player.MediaType type, string filename)
        {
            try
            {
                if (currentPlayingItem != null && currentPlayingItem.Util != null)
                {
                    double percent = g_Player.Duration > 0 ? g_Player.CurrentPosition / g_Player.Duration : 0;
                    currentPlayingItem.Util.OnPlaybackEnded(currentPlayingItem.Video, currentPlayingItem.FileName, percent, false);
                }
            }
            catch (Exception ex)
            {
                Log.Instance.Warn("Error on Util.OnPlaybackEnded: {0}", ex);
            }

            if (currentPlaylist != null)
            {
                if ((g_Player.Player != null && g_Player.Player.GetType().Assembly == typeof(GUIOnlineVideos).Assembly) ||
                     g_Player.Player == null && (filename == "http://localhost/OnlineVideo.mp4" || (currentPlayingItem != null && filename == currentPlayingItem.FileName)))
                {
                    PlayNextPlaylistItem();
                }
                else
                {
                    // some other playback ended, and a playlist is still set here -> clear it
                    currentPlaylist = null;
                    currentPlayingItem = null;
                }
            }
            else
            {
                TrackPlayback();
                currentPlayingItem = null;
            }
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:35,代码来源:GUIOnlineVideos.cs

示例13: PlayRecording

    public static bool PlayRecording(Recording rec, double startOffset, g_Player.MediaType mediaType)
    {
      string fileName = GetFileNameForRecording(rec);

      bool useRTSP = TVHome.UseRTSP();
      string chapters = useRTSP ? TVHome.TvServer.GetChaptersForFileName(rec.IdRecording) : null;

      Log.Info("PlayRecording:{0} - using rtsp mode:{1}", fileName, useRTSP);
      if (g_Player.Play(fileName, mediaType, chapters, false)) // Force to use TsReader if true it will use Movie Codec and Splitter
      {
        if (Utils.IsVideo(fileName) && !g_Player.IsRadio)
        {
          g_Player.ShowFullScreenWindow();
        }
        if (startOffset > 0)
        {
          g_Player.SeekAbsolute(startOffset);
        }
        else if (startOffset == -1)
        {
          // 5 second margin is used that the TsReader wont stop playback right after it has been started
          double dTime = g_Player.Duration - 5;
          g_Player.SeekAbsolute(dTime);
        }
        
        TvRecorded.SetActiveRecording(rec);

        //populates recording metadata to g_player;
        g_Player.currentFileName = rec.FileName;
        g_Player.currentTitle = GetDisplayTitle(rec);
        g_Player.currentDescription = rec.Description;

        rec.TimesWatched++;
        rec.Persist();

        return true;
      }
      return false;
    }
开发者ID:doskabouter,项目名称:MediaPortal-1,代码行数:39,代码来源:TVUtil.cs

示例14: OnPlayBackStarted

    private void OnPlayBackStarted(g_Player.MediaType type, string filename)
    {
      if (type != g_Player.MediaType.Video)
      {
        return;
      }
      AddFileToDatabase(filename);

      int idFile = VideoDatabase.GetFileId(filename);
      if (idFile != -1)
      {
        int movieDuration = (int)g_Player.Duration;
        VideoDatabase.SetMovieDuration(idFile, movieDuration);
      }
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:15,代码来源:GUIVideoFiles.cs

示例15: OnPlayBackEnded

    private void OnPlayBackEnded(g_Player.MediaType type, string filename)
    {
      if (type != g_Player.MediaType.Video)
      {
        return;
      }

      // Handle all movie files from idMovie
      ArrayList movies = new ArrayList();
      HashSet<string> watchedMovies = new HashSet<string>();

      int iidMovie = VideoDatabase.GetMovieId(filename);
      if (iidMovie >= 0)
      {
        VideoDatabase.GetFiles(iidMovie, ref movies);

        for (int i = 0; i < movies.Count; i++)
        {
          string strFilePath = (string)movies[i];
          byte[] resumeData = null;
          int idFile = VideoDatabase.GetFileId(strFilePath);
          if (idFile < 0)
          {
            break;
          }
          // Set resumedata to zero
          VideoDatabase.GetMovieStopTimeAndResumeData(idFile, out resumeData);
          VideoDatabase.SetMovieStopTimeAndResumeData(idFile, 0, resumeData);
          watchedMovies.Add(strFilePath);
        }

        int playTimePercentage = 0;

        if (_isStacked && _totalMovieDuration != 0)
        {
          int duration = 0;

          for (int i = 0; i < _stackedMovieFiles.Count; i++)
          {
            int fileID = VideoDatabase.GetFileId((string)_stackedMovieFiles[i]);

            if (filename != (string)_stackedMovieFiles[i])
            {
              duration += VideoDatabase.GetMovieDuration(fileID);
              continue;
            }
            playTimePercentage = (int)(100 * (duration + g_Player.Player.CurrentPosition) / _totalMovieDuration);
            break;
          }
        }
        else
        {
          playTimePercentage = 100;
        }

        if (playTimePercentage >= 80)
        {
          IMDBMovie details = new IMDBMovie();
          VideoDatabase.GetMovieInfoById(iidMovie, ref details);
          details.Watched = 1;
          VideoDatabase.SetWatched(details);
          VideoDatabase.SetMovieWatchedStatus(iidMovie, true);
        }
      }
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:65,代码来源:GUIVideoFiles.cs


注:本文中的MediaPortal.Player.g_Player类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。