Offline quick guide for real integration work. This file summarizes the official docs so you can still build and use the player even if the website is unavailable.
This guide focuses on the practical public browser SDK flow:
- Prepare the runtime files
- Create the player container
- Build the player
- Bind the minimum required callbacks
- Load media
- Play, pause, seek, resize, screenshot, fullscreen, and switch media
If you only need one page to get started quickly, read this file first.
For normal browser playback, keep these files together:
h265web.jsh265web_wasm.jsh265web_wasm.wasmextjs.jsextwasm.js
A common local layout looks like this:
root/
├── index.html
├── index.js
├── resource/
│ └── demo.mp4
└── output/
├── h265web.js
├── h265web_wasm.js
├── h265web_wasm.wasm
├── extjs.js
└── extwasm.js
Both SDK resource paths and media URLs support:
- Full URL:
https://example.com/output/h265web_wasm.js - Site-absolute path:
/output/h265web_wasm.js - Relative path:
./output/h265web_wasm.js
If the four SDK runtime files are in the same directory, use base_url and keep the file names short.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>h265web.js PRO Demo</title>
<script src="./output/h265web.js"></script>
</head>
<body>
<div id="canvas111"></div>
<script src="./index.js"></script>
</body>
</html>This is the recommended public integration flow:
- Create the player object
- Bind callbacks
- Call
build(config) - Call
load_media(mediaUrl) - Let
auto_playstart playback, or callplay()after the first frame is ready
const ylplayer = H265webjsPlayer();
ylplayer.on_ready_show_done_callback = function () {
console.log('first frame ready');
};
ylplayer.video_probe_callback = function (mediaInfo) {
console.log('media info', mediaInfo);
};
ylplayer.build({
player_id: 'canvas111',
base_url: './output/',
wasm_js_uri: 'h265web_wasm.js',
wasm_wasm_uri: 'h265web_wasm.wasm',
ext_src_js_uri: 'extjs.js',
ext_wasm_js_uri: 'extwasm.js',
width: '100%',
height: 480,
color: '#101318',
auto_play: true,
readframe_multi_times: -1,
ignore_audio: false
});
ylplayer.load_media('./resource/demo.mp4');These are the minimum callbacks you should wire before doing anything else.
Fires when the first frame is ready and visible.
ylplayer.on_ready_show_done_callback = function () {
console.log('on_ready_show_done_callback');
};Fires when media probing finishes and basic stream info becomes available.
ylplayer.video_probe_callback = function (mediaInfo) {
console.log('video_probe_callback', mediaInfo);
};Use these when you need progress, cache state, seek state, or finish state.
ylplayer.on_cache_process_callback = function (timestamp) {
console.log('on_cache_process_callback', timestamp);
};
ylplayer.on_load_caching_callback = function () {
console.log('on_load_caching_callback');
};
ylplayer.on_finish_cache_callback = function (data) {
console.log('on_finish_cache_callback', data);
};
ylplayer.on_play_time = function (pts) {
console.log('on_play_time', pts);
};
ylplayer.on_play_finished = function () {
console.log('on_play_finished');
};
ylplayer.on_seek_start_callback = function (seekTarget) {
console.log('on_seek_start_callback', seekTarget);
};
ylplayer.on_seek_done_callback = function (seekTarget) {
console.log('on_seek_done_callback', seekTarget);
};| Field | Type | Required | Notes |
|---|---|---|---|
player_id |
string |
Yes | Container element id |
wasm_js_uri |
string |
Yes | Path to h265web_wasm.js |
wasm_wasm_uri |
string |
Yes | Path to h265web_wasm.wasm |
ext_src_js_uri |
string |
No | Path to extjs.js |
ext_wasm_js_uri |
string |
No | Path to extwasm.js |
base_url |
string |
No | Shared base path for the four SDK runtime files |
width |
number | string |
No | Player width |
height |
number | string |
No | Player height |
color |
string |
No | Player background color |
auto_play |
boolean |
No | Auto start playback after media is ready |
readframe_multi_times |
number |
No | Demux read scale |
ignore_audio |
boolean |
No | Ignore audio track |
core |
string |
No | Explicit core: mse_hevc, wasm_hevc, webcodec_hevc |
media_uri |
string |
No | Optional media URL, but public usage still recommends build() then load_media() |
Even though media_uri exists, the clean public usage is still:
ylplayer.build(config);
ylplayer.load_media(mediaUrl);That keeps player creation and media loading separate, and it matches the current docs and demos.
ylplayer.load_media('./resource/demo.mp4');
ylplayer.change_media('./resource/another-demo.mp4');
ylplayer.release();ylplayer.play();
ylplayer.pause();
ylplayer.seek(10);
ylplayer.set_playback_rate(2.0);
ylplayer.set_voice(0.5);
ylplayer.set_mute();ylplayer.next_frame();
ylplayer.resize(640, 480);
ylplayer.fullScreen();
ylplayer.closeFullScreen();
ylplayer.screenshot('screenshot');Screenshot example:
<img id="screenshot" style="width:400px;height:340px;background:#e9e9e9;" />If you want to force a specific playback path, use core.
ylplayer.build({
player_id: 'canvas111',
base_url: './output/',
wasm_js_uri: 'h265web_wasm.js',
wasm_wasm_uri: 'h265web_wasm.wasm',
ext_src_js_uri: 'extjs.js',
ext_wasm_js_uri: 'extwasm.js',
core: 'webcodec_hevc'
});Current public core values:
mse_hevcwasm_hevcwebcodec_hevc
If you do not set core, the SDK chooses automatically.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>h265web.js PRO Demo</title>
<script src="./output/h265web.js"></script>
</head>
<body>
<div id="canvas111"></div>
<button id="play_btn" onclick="play()" disabled>PLAY</button>
<button id="pause_btn" onclick="pause()" disabled>PAUSE</button>
<button id="voice_btn" onclick="setVoice()" disabled>VOLUME</button>
<script src="./index.js"></script>
</body>
</html>let ylplayer = null;
const mediaUrl = './resource/hevc_test_moov_set_head_16s.mp4';
function createPlayer(core = null) {
if (ylplayer) {
ylplayer.release();
ylplayer = null;
}
ylplayer = H265webjsPlayer();
ylplayer.on_ready_show_done_callback = function () {
document.getElementById('play_btn').disabled = false;
document.getElementById('pause_btn').disabled = false;
document.getElementById('voice_btn').disabled = false;
};
ylplayer.video_probe_callback = function (mediaInfo) {
console.log('mediaInfo', mediaInfo);
};
ylplayer.on_play_time = function (pts) {
console.log('play pts', pts);
};
const playerConfig = {
player_id: 'canvas111',
base_url: './output/',
wasm_js_uri: 'h265web_wasm.js',
wasm_wasm_uri: 'h265web_wasm.wasm',
ext_src_js_uri: 'extjs.js',
ext_wasm_js_uri: 'extwasm.js',
width: '100%',
height: 480,
color: '#101318',
auto_play: true,
readframe_multi_times: -1,
ignore_audio: false
};
if (core) {
playerConfig.core = core;
}
ylplayer.build(playerConfig);
}
function buildPlayer(core = null) {
createPlayer(core);
ylplayer.load_media(mediaUrl);
}
function play() {
ylplayer && ylplayer.play();
}
function pause() {
ylplayer && ylplayer.pause();
}
function setVoice() {
ylplayer && ylplayer.set_voice(1.0);
}
window.onload = function () {
buildPlayer();
};Run a normal static web server:
python3 -m http.server 8080The easiest pattern is:
base_url: './output/'wasm_js_uri: 'h265web_wasm.js'wasm_wasm_uri: 'h265web_wasm.wasm'ext_src_js_uri: 'extjs.js'ext_wasm_js_uri: 'extwasm.js'
Even if auto_play: true is set, browser policy can still restrict playback until user interaction in some cases.
For public integration and troubleshooting, keep this order:
ylplayer.build(config);
ylplayer.load_media(mediaUrl);If you are debugging a new page, first confirm:
video_probe_callbackon_ready_show_done_callback
Only after those are correct should you continue to seek logic, cache logic, and UI logic.
- SDK files are present in
./output/ - Page is served from a static web server
player_idmatches a real DOM elementbuild(config)runs beforeload_media(mediaUrl)video_probe_callbackis wiredon_ready_show_done_callbackis wired- Media URL is reachable
- Browser autoplay restrictions are considered
If the website is available, these are still the main public entry points:
- Public demo:
https://h265web.com/player.php - Docs:
https://h265web.com/markdown-docs/get-started.php
This file exists so you still have a usable offline integration guide even when those pages are not reachable.