This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Splash(BaseState): | |
def __init__(self): | |
super(Splash, self).__init__() | |
self.title = self.font.render("PyGalaga", True, pygame.Color("blue")) | |
self.title_rect = self.title.get_rect(center=self.screen_rect.center) | |
self.next_state = "MENU" | |
self.time_active = 0 | |
def update(self, dt): | |
self.time_active += dt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run(self): | |
while not self.done: | |
dt = self.clock.tick(self.fps) | |
self.event_loop() | |
self.update(dt) | |
self.draw() | |
pygame.display.update() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseState(object): | |
def __init__(self): | |
self.done = False | |
self.quit = False | |
self.next_state = None | |
self.screen_rect = pygame.display.get_surface().get_rect() | |
self.font = pygame.font.Font(None, 32) | |
def startup(self): | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseState(object): | |
def __init__(self): | |
self.done = False | |
self.quit = False | |
self.next_state = None | |
self.screen_rect = pygame.display.get_surface().get_rect() | |
self.font = pygame.font.Font(None, 32) | |
def startup(self): | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cert = fetch("YOUR FAIRPLAY CERTIFICATE URL"); | |
if (this.platform.SAFARI) { | |
this.player.configure({ | |
preferredAudioLanguage: 'en-US', | |
drm: { | |
servers: { | |
'com.apple.fps.1_0': '[fairplay license server URL]', | |
}, | |
advanced: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let captionUrl = "http://amssamples.streaming.mediaservices.windows.net/bc57e088-27ec-44e0-ac20-a85ccbcd50da/TOS-en.vtt"; | |
this.player | |
.load(videoUrl) | |
.then(() => { | |
this.player.addTextTrackAsync(captionUrl, "en", "subtitle", 'text/vtt').then(() => {{ | |
const textTracks = this.player.getTextTracks(); | |
if (textTracks.length > 0) { | |
this.player.setTextTrackVisibility(true); | |
this.player.selectTextTrack(textTracks[0]); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let videoUrl = "http://www.bok.net/dash/tears_of_steel/cleartext/stream.mpd"; | |
if (this.platform.SAFARI) { | |
videoUrl = "http://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel.ism/.m3u8"; | |
} | |
this.player | |
.load(videoUrl) | |
.then(() => { | |
this.videoElement?.play(); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="videoContainer" #videoContainer class="amsterdam-acid-blue"> | |
<video #videoPlayer id="videoPlayer" width="100%" height="100%"> | |
</video> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private initPlayer() { | |
this.player = new shaka.Player(this.videoElement); | |
const ui = new shaka.ui.Overlay( | |
this.player, | |
this.videoContainerElement, | |
this.videoElement | |
); | |
this.player |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, AfterViewInit, ElementRef, ViewChild } from '@angular/core'; | |
declare let shaka: any; | |
@Component({ | |
selector: 'app-shaka-player', | |
templateUrl: './shaka-player.component.html', | |
styleUrls: ['./shaka-player.component.css'], | |
}) | |
export class ShakaPlayerComponent implements AfterViewInit { | |
@ViewChild('videoPlayer') videoElementRef: ElementRef | undefined; |