Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
.url-input button {
flex: initial;
margin-left: 8px;
margin-right: 8px;
}

.options {
Expand Down
27 changes: 27 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<label for="sURL">Stream URL:</label>
<input id="sURL" type="text" value="http://127.0.0.1/flv/7182741-1.flv" />
<button onclick="switch_mds()">Switch to MediaDataSource</button>
<label for="file">FLV File:</label>
<input type="file" id="file" accept=".flv" onchange="flv_file_load()" />
</div>
<div class="options">
<input type="checkbox" id="isLive" onchange="saveSettings()" checked />
Expand Down Expand Up @@ -107,6 +109,31 @@
player.load();
}

function flv_file_load() {
var fileEl = document.getElementById('file');
var file = fileEl.files[0];

if (!file) {
return;
}

console.log('FLV File:', file);

var i;
var mediaDataSource = {
type: 'flv'
};
for (i = 0; i < checkBoxFields.length; i++) {
var field = checkBoxFields[i];
/** @type {HTMLInputElement} */
var checkbox = document.getElementById(field);
mediaDataSource[field] = checkbox.checked;
}
mediaDataSource['url'] = URL.createObjectURL(file);
console.log('MediaDataSource:', mediaDataSource);
player_load_mds(mediaDataSource);
}

function player_start() {
player.play();
}
Expand Down