Play All

@param string $base64

@return null|string|void
@throws \Exception
557685
public function playAll($base64)
    {
        try {
            /**
             * Decode Path
             */
            $base64 = base64_decode($base64);

            /**
             * Path to File on Disk
             */
            $path = $this->getSearchPath() . '/' . $base64;

            /**
             * Path to Web URL
             */
            $file = ltrim($this->getBaseDir() . '/' . $base64, '/');

            /**
             * Server URL
             */
            $serverUrl = $this->serverUrl->get('serverurl')
                                         ->__invoke('/');

            clearstatcache();

            if (is_dir($path)) {
                $array = $this->directoryListing($base64);

                if (is_array($array) && count($array) > '0') {
                    switch ($this->getFormat()) {
                        /**
                         * Windows Media Player
                         */
                        case 'm3u':
                            $playlist = '#EXTM3U' . "\n";

                            foreach ($array as $value) {
                                $playlist .= '#EXTINF: ';
                                $playlist .= $value['name'];
                                $playlist .= "\n";
                                $playlist .= $serverUrl;
                                $playlist .= str_replace(' ', '%20', $file . '/' . $value['name']);
                                $playlist .= "\n\n";
                            }

                            header("Content-Type: audio/mpegurl");
                            header("Content-Disposition: attachment; filename=" . basename($path) . ".m3u");

                            echo $playlist;

                            exit;

                            break;

                        /**
                         * Winamp
                         */
                        case 'pls':
                            $playlist = '[Playlist]' . "\n";

                            foreach ($array as $key => $value) {
                                $id3 = $this->getId3($path . '/' . $value['name']);

                                $name = !empty($id3['comments_html']['title'])
                                    ? implode(
                                        '<br>',
                                        $id3['comments_html']['title']
                                    )
                                    : basename($value['name']);

                                $length = !empty($id3['playtime_string'])
                                    ? $id3['playtime_string']
                                    : '-1';

                                $keyNum = ($key + 1);

                                $playlist .= 'File';
                                $playlist .= $keyNum;
                                $playlist .= '=' . $serverUrl;
                                $playlist .= str_replace(' ', '%20', $file . '/' . $value['name']);
                                $playlist .= "\n";
                                $playlist .= 'Title' . $keyNum . '=' . $name . "\n";
                                $playlist .= 'Length' . $keyNum . '=' . $this->convertTime($length) . "\n";
                            }

                            $playlist .= 'Numberofentries=' . count($array) . "\n";
                            $playlist .= 'Version=2' . "\n";

                            header("Content-Type: audio/x-scpls");
                            header("Content-Disposition: attachment; filename=" . basename($path) . ".pls");

                            echo $playlist;

                            exit;

                            break;

                        /**
                         * Error
                         */
                        default:
                            throw new \Exception(
                                $this->translate->translate(
                                    'Format is not currently supported. Supported formats are: pls, m3u',
                                    'mp3'
                                )
                            );
                    }
                } else {
                    throw new \Exception(
                        $this->translate->translate(
                            'Something went wrong and we cannot play this folder',
                            'mp3'
                        )
                    );
                }
            } else {
                throw new \Exception(
                    $path . ' ' . $this->translate->translate(
                        'was not found',
                        'mp3'
                    )
                );
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
1321961
protected function processPlayers(Buffer $buffer)
    {
        // Some games do not have a number of current players
        $playerCount = 0;

        // Set the result to a new result instance
        $result = new Result();

        // Loop until we are out of data
        while ($buffer->getLength()) {
            // Make a new buffer with this block
            $playerInfo = new Buffer($buffer->readString("\x0A"));

            // Add player info
            $result->addPlayer('frags', $playerInfo->readString("\x20"));
            $result->addPlayer('ping', $playerInfo->readString("\x20"));

            // Skip first "
            $playerInfo->skip(1);

            // Add player name, encoded
            $result->addPlayer('name', utf8_encode(trim(($playerInfo->readString('"')))));

            // Skip first "
            $playerInfo->skip(2);

            // Add address
            $result->addPlayer('address', trim($playerInfo->readString('"')));

            // Increment
            $playerCount++;

            // Clear
            unset($playerInfo);
        }

        $result->add('clients', $playerCount);

        // Clear
        unset($buffer, $playerCount);

        return $result->fetch();
    }
872136
public function bridge_start_playback($bridgeId = NULL, $media = NULL, $lang = NULL, $offsetms = NULL, $skipms = NULL, $playbackId = NULL)
	{
		return $this->playback_start($bridgeId, $media, $lang, $offsetms, $skipms, $playbackId);
	}
1072816
async def play(self, ctx, *, query):
        """"""

        source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(query))
        ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None)

        await ctx.send('Now playing: {}'.format(query))
1280941
public function seek($position)
    {
        if ($position < 0) {
            throw new Exception(sprintf('%s() can\'t seek stream to negative line %d', __METHOD__, $position));
        }

        $this->rewind();
        while ($this->key() !== $position && $this->valid()) {
            $this->current();
            $this->next();
        }
        
        if (0 !== $position) {
            $this->offset--;
        }
        
        $this->current();
    }
782248
public function downloadSingle($base64)
    {
        try {
            /**
             * Path to File on Disk
             */
            $path = $this->getSearchPath() . '/' . base64_decode($base64);

            clearstatcache();

            if (is_file($path)) {
                header("Content-Type: audio/mpeg");
                header("Content-Disposition: attachment; filename=" . basename($this->cleanPath($path)));
                header("Content-Length: " . filesize($path));

                $handle = fopen(
                    $path,
                    'rb'
                );

                $contents = fread(
                    $handle,
                    filesize($path)
                );

                while ($contents) {
                    echo $contents;
                }

                fclose($handle);
            } else {
                throw new \Exception(
                    $path . ' ' . $this->translate->translate(
                        'was not found',
                        'mp3'
                    )
                );
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
846711
def play(quiet, session_file, shell, speed, prompt, commentecho):
    """"""
    run(
        session_file.readlines(),
        shell=shell,
        speed=speed,
        quiet=quiet,
        test_mode=TESTING,
        prompt_template=prompt,
        commentecho=commentecho,
    )
178403
def play_empty(self):
        """"""
        if self.vclient:
            if self.streamer:
                self.streamer.volume = 0
            self.vclient.play_audio("\n".encode(), encode=False)
1288082
public function getBase64()
    {
        if ($this->owner->exists()) {
            $file = $this->owner->getFullPath();
            $mime = mime_content_type($file);
            $fileContent = file_get_contents($file);
            return "data://$mime;base64," . base64_encode($fileContent);
        }
        
        return null;
    }
11085
public function resetAllForAllPlayers($optParams = array())
  {
    $params = array();
    $params = array_merge($params, $optParams);
    return $this->call('resetAllForAllPlayers', array($params));
  }
869601
public function fromBase64(string $base64):ByteArray{
		$base64 = \trim($base64);

		if(!$this->isAllowedBase64($base64)){
			throw new TraitException('invalid base64 string');
		}

		return $this->fromString(\base64_decode($base64));
	}
1224717
public void play(Tune tune) throws IllegalStateException
  {
    if (m_isStarted)
    {
      try
      {
        m_tune = tune;
        Sequence sequence = m_converter.toMidiSequence(m_tune);
        seq.setSequence(sequence);
        seq.setTempoInBPM(m_tempo);
        seq.start();
      }
      catch (Exception e)
      { e.printStackTrace(); }
    }
    else
      throw new IllegalStateException("The player hasn't been started yet !");
  }
142657
protected function load()
    {
        if ($this->btTable) {
            if ($this->btCacheBlockRecord && $this->btCachedBlockRecord && Config::get('concrete.cache.blocks')) {
                $this->record = unserialize(base64_decode($this->btCachedBlockRecord));
            } else {
                $this->record = new BlockRecord($this->btTable);
                $this->record->bID = $this->bID;
                $this->record->Load('bID=' . $this->bID);
                if ($this->btCacheBlockRecord && Config::get('concrete.cache.blocks')) {
                    // this is the first time we're loading
                    $record = base64_encode(serialize($this->record));
                    $db = Database::connection();
                    $db->Execute('update Blocks set btCachedBlockRecord = ? where bID = ?', [$record, $this->bID]);
                }
            }
        }

        $event = new \Symfony\Component\EventDispatcher\GenericEvent();
        $event->setArgument('record', $this->record);
        $event->setArgument('btHandle', $this->btHandle);
        $event->setArgument('bID', $this->bID);
        $ret = Events::dispatch('on_block_load', $event);
        $this->record = $ret->getArgument('record');

        if (is_object($this->record)) {
            foreach ($this->record as $key => $value) {
                $this->{$key} = $value;
                $this->set($key, $value);
            }
        }
    }
1132045
public function onPlayerHit($params)
    {
        $this->dispatch(__FUNCTION__, [
            $params['shooter'],
            $params['victim'],
            $params['weapon'],
            $params['damage'],
            $params['points'],
            $params['distance'],
            Position::fromArray($params['shooterposition']),
            Position::fromArray($params['victimposition']),
        ]);
    }
489242
public static function create($base64)
    {
        if (($pos = strpos($base64, self::STOPPER)) !== false) {
            $base64 = substr($base64, $pos + strlen(self::STOPPER));
        }

        return \Yii::createObject([
            'class'  => self::className(),
            'base64' => $base64
        ]);
    }
896790
def _play(self):
        
        while True:
            if self._buffered:
                self._source.push(self._buffer.get())
224315
public function withPlayAll(bool $playAll): self
    {
        if ($this->playAll == $playAll) {
            return $this;
        }

        $url = clone $this;
        $url->playAll = $playAll;

        return $url;
    }