-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shengming Yuan
committed
Mar 1, 2019
1 parent
99839e9
commit 3935d27
Showing
12 changed files
with
373 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
47 changes: 47 additions & 0 deletions
47
src/app/components/platforms/sina-live/sina-live.component.html
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<div class="container"> | ||
<h3>微博直播流获取</h3> | ||
<div class="row"> | ||
<form class="col s12"> | ||
<div class="row"> | ||
<div class="col s12"> | ||
<p>请输入节目ID</p> | ||
<span> | ||
http://live.weibo.com/show?id= | ||
</span> | ||
<div class="input-field inline"> | ||
<input style="width:200px" id="showId_inline" name="showId" type="text" [(ngModel)]="showId"> | ||
</div> | ||
<a class="btn" (click)="loadStreamList()">解流</a> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
<div class="row"> | ||
<div class="col s4"> | ||
<label for="uid">微博用户ID</label> | ||
<input name="uid" type="text" [(ngModel)]="uid"> | ||
</div> | ||
<div class="col s4"> | ||
<label for="expiresHours">保活时长(小时)</label> | ||
<input name="expiresHours" disabled class="disbaled" type="number" min="1" max="4" [(ngModel)]="expiresHours"> | ||
</div> | ||
</div> | ||
<div class="row" id="table" *ngIf="showStreamListTable"> | ||
<table class="responsive-table highlight striped"> | ||
<thead> | ||
<tr> | ||
<th>类型</th> | ||
<th>分辨率</th> | ||
<th>链接</th> | ||
</tr> | ||
</thead> | ||
<tbody *ngFor="let item of streamList"> | ||
<tr> | ||
<td>视频</td> | ||
<td>{{item.title}}</td> | ||
<td>{{item.url}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> |
Empty file.
25 changes: 25 additions & 0 deletions
25
src/app/components/platforms/sina-live/sina-live.component.spec.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { SinaLiveComponent } from './sina-live.component'; | ||
|
||
describe('SinaLiveComponent', () => { | ||
let component: SinaLiveComponent; | ||
let fixture: ComponentFixture<SinaLiveComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ SinaLiveComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(SinaLiveComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
57 changes: 57 additions & 0 deletions
57
src/app/components/platforms/sina-live/sina-live.component.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { SinaLiveService } from '../../../providers/platforms/sina-live.service'; | ||
import { ElectronService } from '../../../providers/electron.service'; | ||
|
||
@Component({ | ||
selector: 'app-sina-live', | ||
templateUrl: './sina-live.component.html', | ||
styleUrls: ['./sina-live.component.scss'] | ||
}) | ||
export class SinaLiveComponent implements OnInit { | ||
|
||
constructor( | ||
private sinaLiveService: SinaLiveService, | ||
private electronService: ElectronService | ||
) { } | ||
|
||
showId = ''; | ||
uid = '6778227457'; | ||
expiresHours = 2; | ||
|
||
streamList = []; | ||
showStreamListTable = false; | ||
|
||
ngOnInit() { | ||
} | ||
|
||
loadStreamList() { | ||
this.showStreamListTable = false; | ||
this.streamList = []; | ||
let queryStr = this.sinaLiveService.buildQueryString(this.showId, this.uid); | ||
let sign = this.sinaLiveService.getSign(queryStr); | ||
let uri = this.sinaLiveService.buildStreamUri(); | ||
|
||
this.sinaLiveService.getStream(uri) | ||
.subscribe(response => { | ||
if (response['status'] === 0) { | ||
this.electronService.remote.dialog.showMessageBox({ | ||
type: 'error', | ||
message: '获取信息失败,请检查您的网络链接/流服务平台状态' | ||
}); | ||
} else { | ||
this.streamList = response['stream']; | ||
this.streamList.push({ | ||
title: 'RTMP', | ||
url: response['rtmp_url'] | ||
}); | ||
this.showStreamListTable = true; | ||
} | ||
}, err => { | ||
this.electronService.remote.dialog.showMessageBox({ | ||
type: 'error', | ||
message: '获取信息失败,请检查您的网络链接/流服务平台状态' | ||
}); | ||
}); | ||
} | ||
|
||
} |
Oops, something went wrong.