Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,150 --> 00:00:03,990
In this lecture, we're going to install the Firebase SDK.
2
00:00:04,019 --> 00:00:10,260
The Firebase SDK is a library that will assist us with communicating with Firebase as products.
3
00:00:10,290 --> 00:00:14,130
SDK is short for software development kits.
4
00:00:14,130 --> 00:00:15,870
It'll make our lives easier.
5
00:00:15,870 --> 00:00:22,020
In the resource section of this lecture, I provide a link to the installation page for the SDK.
6
00:00:22,260 --> 00:00:26,190
This page goes into detail on how you can install Firebase.
7
00:00:26,190 --> 00:00:29,190
The SDK can be installed with NPM.
8
00:00:29,190 --> 00:00:30,690
Let's try installing it.
9
00:00:30,690 --> 00:00:33,750
Switch over to the command line and the command line.
10
00:00:33,750 --> 00:00:38,880
Run the following command and PM i firebase at eight.
11
00:00:41,160 --> 00:00:44,480
After a few moments, Firebase should have been installed.
12
00:00:44,490 --> 00:00:48,090
Let's start configuring Firebase into our project.
13
00:00:48,090 --> 00:00:54,120
Before adding the configuration, we should ask ourselves, where should we write the configuration?
14
00:00:54,210 --> 00:00:58,980
It's possible to configure Firebase directly from the main JS file.
15
00:00:59,010 --> 00:01:05,010
On the other hand, I think it would be a good idea to separate the configuration into another file.
16
00:01:05,129 --> 00:01:11,070
Separation will reduce clutter in the main JS file in the includes directory.
17
00:01:11,100 --> 00:01:14,670
Create a file called Firebase dot js.
18
00:01:16,860 --> 00:01:21,750
You don't have to call it this, but I recommend keeping the name short and relevant.
19
00:01:21,780 --> 00:01:24,870
Next, open the main JS file.
20
00:01:26,900 --> 00:01:34,670
We'll import the file into the main JS file, otherwise the code inside the Firebase file will never
21
00:01:34,670 --> 00:01:39,110
execute below the import statement for the validation file.
22
00:01:39,140 --> 00:01:41,750
Import the Firebase module.
23
00:01:43,770 --> 00:01:48,940
We can begin to configure Firebase switch back to the Firebase File.
24
00:01:48,960 --> 00:01:52,680
The first thing we'll do is import the Firebase module.
25
00:01:55,050 --> 00:02:00,090
We're importing a specific module from the Firebase Library called App.
26
00:02:00,120 --> 00:02:04,140
The App Module is the core of the Firebase SDK.
27
00:02:04,170 --> 00:02:09,669
Regardless of what services or products you plan on using, the core must always be imported.
28
00:02:09,690 --> 00:02:14,640
The core module is what will help you with configuring and connecting to Firebase.
29
00:02:14,670 --> 00:02:20,230
If we were to omit the app from the path, we'd be importing every Firebase feature.
30
00:02:20,250 --> 00:02:24,120
This includes features we aren't actively using or need.
31
00:02:24,150 --> 00:02:27,860
This will unnecessarily increase the bundle size of our app.
32
00:02:27,870 --> 00:02:33,120
The proper way of importing Firebase is to individually import what we need.
33
00:02:33,270 --> 00:02:40,710
The Firebase module is broken up into packages by passing in Firebase alone, you're telling it to import
34
00:02:40,710 --> 00:02:42,190
all of its packages.
35
00:02:42,210 --> 00:02:46,360
In almost all cases, you will need to import the app package.
36
00:02:46,380 --> 00:02:48,910
This package is the core of Firebase.
37
00:02:48,930 --> 00:02:53,350
The rest of the features won't be usable unless you import this first.
38
00:02:53,370 --> 00:03:01,340
If you're on version nine of Firebase, the path must be updated to Firebase Slash Compat slash app.
39
00:03:01,350 --> 00:03:05,310
You can verify the version of Firebase by viewing the package.
40
00:03:05,310 --> 00:03:11,700
For those of you on older versions of Firebase, the compatibility path does not need to be added.
41
00:03:11,730 --> 00:03:12,660
Otherwise.
42
00:03:12,660 --> 00:03:18,390
Every time we import Firebase, you should always modify your path to include this directory.
43
00:03:18,540 --> 00:03:23,730
The next step is to grab the connectivity details from Firebase in the browser.
44
00:03:23,760 --> 00:03:27,270
Navigate to the console for the music project.
45
00:03:29,070 --> 00:03:31,310
You should be on the overview page.
46
00:03:31,320 --> 00:03:35,370
You can navigate there by clicking on the menu item in the sidebar.
47
00:03:35,400 --> 00:03:39,840
At the top of the page, Firebase will ask us to select a platform.
48
00:03:39,840 --> 00:03:43,950
We can select iOS, Android, Web or Unity.
49
00:03:43,950 --> 00:03:46,560
We'll want to click on the one that says Web.
50
00:03:48,820 --> 00:03:53,360
A pop up will appear asking us for more details about our project.
51
00:03:53,380 --> 00:03:56,350
It's going to ask us to assign a nickname.
52
00:03:56,350 --> 00:03:59,650
We'll give the project the nickname Music.
53
00:04:01,850 --> 00:04:05,450
It'll ask us if we'd like to host the app on Firebase.
54
00:04:05,480 --> 00:04:07,720
We'll look into that in a later section.
55
00:04:07,730 --> 00:04:10,630
Let's leave this option unchecked.
56
00:04:10,640 --> 00:04:13,230
We can enable hosting later if we'd like.
57
00:04:13,250 --> 00:04:15,090
Let's keep moving forward.
58
00:04:15,110 --> 00:04:20,390
After a while, Firebase will spit out a configuration object you can copy and paste.
59
00:04:20,390 --> 00:04:23,240
We're not going to copy the entire code snippet.
60
00:04:23,240 --> 00:04:26,510
Just copy the Firebase config variable.
61
00:04:28,650 --> 00:04:30,130
Go back to the editor.
62
00:04:30,150 --> 00:04:34,200
Paste the variable into the Firebase configuration file.
63
00:04:36,210 --> 00:04:38,520
Let's go over the object together.
64
00:04:38,550 --> 00:04:41,580
The very first property is the API key.
65
00:04:41,610 --> 00:04:45,790
The API key is how will be able to connect to Firebase.
66
00:04:45,810 --> 00:04:52,080
It's how we let Firebase know that we're the ones sending the request and not some other application.
67
00:04:52,260 --> 00:04:55,780
The next property is the authentication domain.
68
00:04:55,800 --> 00:05:01,500
Firebase will provide us with a URL where we can send the authentication information.
69
00:05:01,530 --> 00:05:05,700
It's what we'll need if we want to add authentication to our app.
70
00:05:05,730 --> 00:05:08,190
Next, there's the project ID.
71
00:05:08,220 --> 00:05:10,440
It's followed by the storage bucket.
72
00:05:10,470 --> 00:05:17,010
A bucket is used to describe the location where the files are stored and application can have multiple
73
00:05:17,010 --> 00:05:17,700
buckets.
74
00:05:17,700 --> 00:05:21,280
But we're using the free plan, which comes with one bucket.
75
00:05:21,300 --> 00:05:24,510
One bucket is plenty for the application we're building.
76
00:05:24,720 --> 00:05:27,180
The next property is the sender ID.
77
00:05:27,210 --> 00:05:32,690
Firebase comes with a feature to push notifications between applications instantly.
78
00:05:32,700 --> 00:05:36,390
We won't be using this feature, but it is there if you need it.
79
00:05:36,390 --> 00:05:40,350
I'm going to remove this ID since we won't be using it.
80
00:05:40,350 --> 00:05:43,650
Firebase won't throw an error if it's unavailable.
81
00:05:43,680 --> 00:05:46,650
Lastly, we have the app ID property.
82
00:05:46,680 --> 00:05:50,820
Firebase allows for multiple apps to be connected to a project.
83
00:05:50,850 --> 00:05:52,370
We're building a web app.
84
00:05:52,380 --> 00:05:57,070
If we added an iOS or Android app, they would be assigned unique IDs.
85
00:05:57,090 --> 00:06:04,260
Now that we have the configuration object, we can initialize the app by calling the Firebase Dot Initialize
86
00:06:04,260 --> 00:06:05,280
App function.
87
00:06:07,490 --> 00:06:11,080
We can pass the configuration object into the function.
88
00:06:11,090 --> 00:06:17,300
In some cases, the code snippet you copied from Firebase will try calling the function without accessing
89
00:06:17,300 --> 00:06:19,330
it from the Firebase object.
90
00:06:19,340 --> 00:06:22,730
If that's the case, update this line to match mine.
91
00:06:22,730 --> 00:06:25,520
We're not going to structure this function.
92
00:06:25,700 --> 00:06:29,420
This function will initialize firebase by connecting to it.
93
00:06:29,450 --> 00:06:33,680
It'll return an instance of firebase we can use to communicate with it.
94
00:06:33,680 --> 00:06:37,460
Let's export the instance under the default namespace.
95
00:06:39,610 --> 00:06:41,360
This step is important.
96
00:06:41,380 --> 00:06:45,670
Otherwise, the instance will not be accessible to our components.
97
00:06:45,670 --> 00:06:51,820
Whenever we need to use Firebase, we can import this module, switch over to the browser to check if
98
00:06:51,820 --> 00:06:53,020
everything is working.
99
00:06:54,470 --> 00:06:55,540
The page loads.
100
00:06:55,550 --> 00:06:58,690
Normally there's one last step we'll want to take.
101
00:06:58,700 --> 00:07:00,290
Head back to the editor.
102
00:07:02,370 --> 00:07:03,900
At the top of the file.
103
00:07:03,900 --> 00:07:07,500
Import the fire base slash off module.
104
00:07:09,580 --> 00:07:15,620
We're importing the authentication module because we'll be using Firebase to authenticate the user.
105
00:07:15,640 --> 00:07:20,350
If we'd like the authentication service to be available, we'll need to import it.
106
00:07:20,380 --> 00:07:24,010
I want to point out that we're not assigning the module a name.
107
00:07:24,010 --> 00:07:28,240
It's not necessary because Firebase is smart enough to extend the core.
108
00:07:28,270 --> 00:07:30,970
It will not export another object for you.
109
00:07:31,000 --> 00:07:32,000
We're finished.
110
00:07:32,020 --> 00:07:36,610
We've successfully integrated the Firebase SDK into our project.
10504
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.