</div>
<div id="video-actions" class="col-md-4 text-right">
+ <button id="share" class="btn btn-default" (click)="showShareModal()">
+ <span class="glyphicon glyphicon-share"></span> Share
+ </button>
+
<button title="Get magnet URI" id="magnet-uri" class="btn btn-default" (click)="showMagnetUriModal()">
<span class="glyphicon glyphicon-magnet"></span> Magnet
</button>
</div>
</div>
-<div *ngIf="video !== null" bsModal #magnetUriModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="magnetUriModal" aria-hidden="true">
+<div *ngIf="video !== null" bsModal #magnetUriModal="bs-modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="magnetUriModal" aria-hidden="true">
<div class="modal-dialog">
- <div class="modal-content">
+ <div class="modal-content modal-lg">
<div class="modal-header">
<button type="button" class="close" aria-label="Close" (click)="hideMagnetUriModal()">
</div>
</div>
</div>
+
+<div *ngIf="video !== null" bsModal #shareModal="bs-modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="shareModal" aria-hidden="true">
+ <div class="modal-dialog modal-lg">
+ <div class="modal-content">
+
+ <div class="modal-header">
+ <button type="button" class="close" aria-label="Close" (click)="hideShareModal()">
+ <span aria-hidden="true">×</span>
+ </button>
+ <h4 class="modal-title">Share</h4>
+ </div>
+
+ <div class="modal-body">
+ <div class="form-group">
+ <label>URL</label>
+ <input #urlInput (click)="urlInput.select()" type="text" class="form-control input-sm" readonly [value]="getVideoUrl()" />
+ </div>
+
+ <div class="form-group">
+ <label>Embed</label>
+ <input #shareInput (click)="shareInput.select()" type="text" class="form-control input-sm" readonly [value]="getVideoIframeCode()" />
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
private static LOADTIME_TOO_LONG: number = 30000;
@ViewChild('magnetUriModal') magnetUriModal: ModalDirective;
+ @ViewChild('shareModal') shareModal: ModalDirective;
downloadSpeed: number;
error: boolean = false;
}
loadVideo() {
- console.log('<iframe width="560" height="315" src="' + window.location.origin + '/videos/embed/' + this.video.id + '" frameborder="0" allowfullscreen></iframe>');
-
// Reset the error
this.error = false;
// We are loading the video
this.magnetUriModal.hide();
}
+ showShareModal() {
+ this.shareModal.show();
+ }
+
+ hideShareModal() {
+ this.shareModal.hide();
+ }
+
+ getVideoIframeCode() {
+ return '<iframe width="560" height="315" ' +
+ 'src="' + window.location.origin + '/videos/embed/' + this.video.id + '" ' +
+ 'frameborder="0" allowfullscreen>' +
+ '</iframe>';
+ }
+
+ getVideoUrl() {
+ return window.location.href;
+ }
+
private loadTooLong() {
this.error = true;
console.error('The video load seems to be abnormally long.');