duncan3dc\Sonos\Controller::isStreaming PHP 메소드

isStreaming() 공개 메소드

Check if this controller is currently playing a stream.
public isStreaming ( ) : boolean
리턴 boolean
    public function isStreaming()
    {
        $media = $this->getMediaInfo();
        $uri = $media["CurrentURI"];
        # Standard streams
        if (substr($uri, 0, 18) === "x-sonosapi-stream:") {
            return true;
        }
        # Line in
        if (substr($uri, 0, 16) === "x-rincon-stream:") {
            return true;
        }
        return false;
    }

Usage Example

예제 #1
0
 /**
  * Get the current tracks in the queue.
  *
  * @param Controller $controller The Controller to grab the state of
  *
  * @return static
  */
 protected function getTracks(Controller $controller)
 {
     $this->tracks = $controller->getQueue()->getTracks();
     if ($controller->isStreaming()) {
         $media = $controller->getMediaInfo();
         $this->stream = new Stream($media["CurrentURI"]);
     }
     return $this;
 }