-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewController.m
58 lines (45 loc) · 1.64 KB
/
ViewController.m
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
//
// ViewController.m
// MapboxMapVideoLayer
//
// Created by Asheem Mamoowala on 8/15/18.
// Copyright © 2018 Mapbox. All rights reserved.
//
#import "ViewController.h"
#import "VideoStyleLayer.h"
@interface ViewController () <MGLMapViewDelegate> {
MGLMapView * _mapView;
}
@end
@implementation ViewController
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)viewDidLoad {
[super viewDidLoad];
MGLMapView *mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds styleURL:[MGLStyle satelliteStreetsStyleURL]];
mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[mapView setMinimumZoomLevel:2];
[mapView setCenterCoordinate:CLLocationCoordinate2DMake(37.562984, -122.514426)
zoomLevel:14
animated:NO];
[self.view addSubview:mapView];
[mapView setDelegate:self];
_mapView = mapView;
}
-(void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style {
NSURL *url = [[NSBundle mainBundle] URLForResource:@"drone" withExtension:@"mp4"];
MGLCoordinateQuad quad = {
{37.56238816766053, -122.51596391201019},
{37.56161849366671, -122.51423120498657},
{37.563391708549425, -122.51309394836426},
{37.56410183312965, -122.51467645168304}
};
VideoStyleLayer *layer = [[VideoStyleLayer alloc]
initWithIdentifier:@"graywhalecove_drone"
videoURL:url
coordinateQuad:quad];
[mapView.style addLayer:layer];
}
@end