Example #1
0
            AmpConfig::set('play_type', 'stream', true);
        }
    default:
        $stream_type = AmpConfig::get('play_type');
        if ($stream_type == 'stream') {
            $stream_type = AmpConfig::get('playlist_type');
        }
        break;
}
debug_event('stream.php', 'Stream Type: ' . $stream_type . ' Media IDs: ' . json_encode($media_ids), 5);
if (count($media_ids) || isset($urls)) {
    if ($stream_type != 'democratic') {
        if (!User::stream_control($media_ids)) {
            debug_event('UI::access_denied', 'Stream control failed for user ' . $GLOBALS['user']->username, 3);
            UI::access_denied();
            exit;
        }
    }
    if ($GLOBALS['user']->id > -1) {
        Session::update_username(Stream::get_session(), $GLOBALS['user']->username);
    }
    $playlist = new Stream_Playlist();
    $playlist->add($media_ids);
    if (isset($urls)) {
        $playlist->add_urls($urls);
    }
    // Depending on the stream type, will either generate a redirect or actually do the streaming.
    $playlist->generate_playlist($stream_type, true);
} else {
    debug_event('stream.php', 'No item. Ignoring...', 5);
}