YouTubePHP Documentation

Media
in package

FinalYes

A file to upload: a video, a thumbnail, a caption track, a banner.

Uploads go in one request, as multipart/related when there is metadata to send beside the file and as the bare file when there is not. That suits thumbnails, banners and captions. A large video is better sent with Google's resumable protocol, which this library does not implement yet: a single request holds the whole file in memory and starts over if it fails.

Tags
link
https://developers.google.com/youtube/v3/guides/using_resumable_upload_protocol
since
1.0.0
author

Valithor Obsidion valithor@valgorithms.com

Table of Contents

Properties

$contents  : string
$mimeType  : string

Methods

__construct()  : mixed
fromFile()  : self
Reads a file from disk. The read blocks, so do it before the loop is busy, or keep the file small.
guessMimeType()  : string

Properties

$contents read-only

public string $contents

$mimeType read-only

public string $mimeType = 'application/octet-stream'

Methods

__construct()

public __construct(string $contents[, string $mimeType = 'application/octet-stream' ]) : mixed
Parameters
$contents : string

The file's bytes.

$mimeType : string = 'application/octet-stream'

What they are, e.g. image/png or video/mp4.

fromFile()

Reads a file from disk. The read blocks, so do it before the loop is busy, or keep the file small.

public static fromFile(string $path[, ?string $mimeType = null ]) : self
Parameters
$path : string
$mimeType : ?string = null
Tags
throws
RuntimeException

When the file cannot be read.

Return values
self

guessMimeType()

private static guessMimeType(string $path) : string
Parameters
$path : string
Return values
string
On this page

Search results