-
Notifications
You must be signed in to change notification settings - Fork 0
/
youtube_doc.html
executable file
·82 lines (78 loc) · 3.45 KB
/
youtube_doc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>youtube.js Docs</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="css/bootstrap.css" rel="stylesheet">
<script>
$(document).ready(function(){
$('pre').addClass('prettyprint').attr('tabIndex', 0);
prettyPrint();
});
</script>
</head>
<body>
<div class="container">
<h2>youtube.js Documentation</h2>
<p><a href="http://en.wikipedia.org/wiki/JavaScript_library">Wikipedia</a>: "A <strong>JavaScript library</strong> is a library of pre-written JavaScript which allows for easier development of JavaScript-based applications."</p>
<p><a href="http://jquery.com/">jQuery</a> is an example of a popular library today. youtube.js is another example of a library, written by Pamela Fox, that contains pre-written JavaScript that you can use.</p>
<p>In the youtube.js library, there are four functions you can use:</p>
<ol>
<li>
<strong>Get the Video ID from a Video URL</strong><br>
<br>
Syntax:
<pre>youtube.getIdFromUrl(videoUrlOrID)</pre>
Expects an argument (videoUrlOrID) that is either a youtube video URL or a video ID and returns back the video's ID.
<br>
<br>
Example:
<pre>var vid_id = youtube.getIdFromUrl('http://www.youtube.com/watch?v=epUk3T2Kfno');
//vid_id equals 'epUk3T2Kfno' (notice where the ID is in the original url)</pre>
<br>
</li>
<li>
<strong>Generate a Thumbnail URL from a Video URL</strong><br>
<br>
Syntax:
<pre>youtube.generateThumbnailUrl(videoUrlOrID)</pre>
Expects an argument (videoUrlOrID) that is either a youtube URL or a ID and returns back the URL of the thumbnail for that video.
<br>
<br>
Example:
<pre>var vid_thumbnail = youtube.generateThumbnailUrl('http://www.youtube.com/watch?v=epUk3T2Kfno');
//vid_thumbnail equals 'http://i3.ytimg.com/vi/epUk3T2Kfno/default.jpg' (notice how the video's ID is inserted in the middle of the image url)</pre>
<br>
</li>
<li>
<strong>Generate the URL to Watch a Video from the Video ID</strong><br>
<br>
Syntax:
<pre>youtube.generateWatchUrl(videoUrlOrID)</pre>
Expects an argument (videoUrlOrID) that is either a youtube URL or a ID and returns back the URL for that video.
<br>
<br>
Example:
<pre>var vid_watch = youtube.generateWatchUrl('epUk3T2Kfno');
//vid_watch equals 'https://www.youtube.com/watch?v=epUk3T2Kfno' (notice where the video ID is in the url)</pre>
<br>
</li>
<li>
<strong>Generate the URL to Embed a Video from the Video ID</strong><br>
<br>
Syntax:
<pre>youtube.generateEmbedUrl(videoUrlOrID)</pre>
Expects an argument (videoUrlOrID) that is either a youtube URL or a ID and returns back the embed URL for that video.
<br>
<br>
Example:
<pre>var vid_embed = youtube.generateEmbedUrl('http://www.youtube.com/watch?v=epUk3T2Kfno');
//vid_embed equals 'http://www.youtube.com/embed/epUk3T2Kfno' (notice where the video ID is in the url)</pre>
</li>
</ol>
</div><!--/container-->
</body>
</html>