Media file resolution switching method and device and storage medium

文档序号:1784938 发布日期:2019-12-06 浏览:11次 中文

阅读说明:本技术 一种媒体文件分辨率切换方法、装置及存储介质 (Media file resolution switching method and device and storage medium ) 是由 银国徽 于 2018-05-29 设计创作,主要内容包括:本公开提供了一种媒体文件分辨率切换方法,包括:响应于网页中内嵌播放器所播放媒体文件的分辨率切换事件,在所述网页的媒体资源扩展接口中缓存原分辨率的分段媒体文件;其中,所述媒体文件对应有多个分段媒体文件;根据所述媒体文件的播放点以及所述媒体文件,获取接续所述播放点的目标分辨率的分段媒体文件;将所获取的目标分辨率的分段媒体文件发送至所述媒体资源扩展接口,并通过所述媒体资源扩展接口调用所述网页的媒体元素进行播放。本公开实施例还提供一种媒体文件分辨率切换装置及存储介质。(The present disclosure provides a media file resolution switching method, including: responding to a resolution switching event of a media file played by an embedded player in a webpage, and caching a segmented media file with the original resolution in a media resource expansion interface of the webpage; the media files correspond to a plurality of segmented media files; acquiring a segmented media file with a target resolution ratio continuing the playing point according to the playing point of the media file and the media file; and sending the acquired segmented media file with the target resolution to the media resource expansion interface, and calling the media elements of the webpage for playing through the media resource expansion interface. The embodiment of the disclosure also provides a media file resolution switching device and a storage medium.)

1. A media file resolution switching method is characterized by comprising the following steps:

Responding to a resolution switching event of a media file played by an embedded player in a webpage, and caching a segmented media file with the original resolution in a media resource expansion interface of the webpage;

The media files correspond to a plurality of segmented media files;

acquiring a segmented media file with a target resolution ratio continuing the playing point according to the playing point of the media file and the media file;

And sending the acquired segmented media file with the target resolution to the media resource expansion interface, and calling the media elements of the webpage for playing through the media resource expansion interface.

2. The method of claim 1, wherein caching the segmented media file at the original resolution in the media resource extension interface of the web page comprises:

In the cache of the media resource expansion interface, reserving a segmented media file comprising the original resolution of the playing point and a segmented media file with the playing time later than the original resolution of the playing point;

and when the segmented media file with the playing time earlier than the original resolution of the playing point is cached in the media resource expansion interface, clearing the segmented media file with the playing time earlier than the original resolution of the playing point.

3. The method of claim 1, further comprising:

after receiving a resolution switching event of the media file, performing overtime detection;

and when the resolution switching event returning to the original resolution is not received within the overtime, the segmented media file of the original resolution cached in the media resource expansion interface of the webpage is cleared.

4. The method of claim 1, further comprising:

When the real-time playing point is in the playing period of the segmented media file with the original resolution which is not cleared and a resolution switching event for returning to the original resolution is received,

And calling the media elements of the webpage to play the cached segmented media files with the original resolution through the media resource expansion interface.

5. The method of claim 1, wherein obtaining the segmented media file of the target resolution succeeding the playback point comprises:

When the media file is in a non-streaming media file format,

Determining two key frames which are continuous with the playing point in the media file with the target resolution ratio based on the media information of the media file with the target resolution ratio;

requesting media data between the two key frames in the media file at the target resolution;

and packaging the requested media data and metadata correspondingly calculated according to the requested media data into a segmented media file container to obtain a segmented media file with a target resolution.

6. The method of claim 5,

When the playing point is reached by means of continuous playing,

The first key frame of the two key frames is: adding the first key frame after the playing end time of the segmented media file of the media source in the media resource expansion interface;

The second key frame of the two key frames is: the second key frame is decoded later than the first key frame.

7. The method of claim 5,

When the play point is reached by jumping,

The first key frame of the two key frames is: a first key frame in the media file with a decoding time before the playing point;

the second key frame of the two key frames is: key frames in the media file that are decoded later than the first key frame.

8. The method of claim 5, further comprising:

When two key frames succeeding the playback point in the media file of the target resolution are determined,

Determining the offset and the capacity of a video frame between the two key frames and the offset and the capacity of an audio frame aligned with the video frame in the media file according to the media information identified from the media file with the target resolution;

determining an offset and a capacity of a target interval according to the determined offset and capacity, wherein the target interval comprises the video frame and the audio frame;

And requesting the media server for the media data positioned in the target interval in the media file with the target resolution.

9. the method of claim 5, wherein encapsulating the requested media data and metadata correspondingly computed from the requested media data into a segmented media file container comprises:

filling data representing the type and compatibility of the segmented media file into a file type container of the segmented media file;

populating metadata representing a file level of the segmented media file into a metadata container of the segmented media file;

And correspondingly filling the extracted media data and the metadata describing the media data into a media data container and a metadata container at a segmentation level in a segmentation container of the segmented media file.

10. a media file resolution switching apparatus, comprising:

The cache unit is used for responding to a resolution switching event of a media file played by an embedded player in a webpage and caching a segmented media file with the original resolution in a media resource expansion interface of the webpage; the media files correspond to a plurality of segmented media files;

An obtaining unit, configured to obtain, according to a playing point of the media file and the media file, a segmented media file with a target resolution that is subsequent to the playing point;

And the sending unit is used for sending the acquired segmented media file with the target resolution to the media resource expansion interface and calling the media elements of the webpage to play through the media resource expansion interface.

11. the apparatus according to claim 10, wherein the caching unit is configured to reserve, in the cache of the media resource extension interface, a segmented media file including an original resolution of the playback point and a segmented media file having a playback time later than the original resolution of the playback point;

And when the segmented media file with the playing time earlier than the original resolution of the playing point is cached in the media resource expansion interface, clearing the segmented media file with the playing time earlier than the original resolution of the playing point.

12. the apparatus of claim 10, further comprising:

The detection unit is used for carrying out overtime detection after receiving the resolution switching event of the media file;

The cache unit is further configured to clear the segmented media file of the original resolution cached in the media resource extension interface of the web page when a resolution switching event returning to the original resolution is not received within the timeout period.

13. The apparatus of claim 10, further comprising:

A playing unit, for when the real-time playing point is in the playing time interval of the segmented media file with original resolution not cleared and a resolution switching event returning to the original resolution is received,

And calling the media elements of the webpage to play the cached segmented media files with the original resolution through the media resource expansion interface.

14. the apparatus according to claim 10, wherein the obtaining unit is further configured to, when the media file is in a non-streaming media file format,

Determining two key frames which are continuous with the playing point in the media file with the target resolution ratio based on the media information of the media file with the target resolution ratio;

requesting media data between the two key frames in the media file at the target resolution;

And packaging the requested media data and metadata correspondingly calculated according to the requested media data into a segmented media file container to obtain a segmented media file with a target resolution.

15. The apparatus of claim 14, wherein when the playback point is reached by continuous playback,

The first key frame of the two key frames is: adding the first key frame after the playing end time of the segmented media file of the media source in the media resource expansion interface;

the second key frame of the two key frames is: the second key frame is decoded later than the first key frame.

16. The apparatus of claim 14, wherein when the playpoint is reached by jumping,

The first key frame of the two key frames is: a first key frame in the media file with a decoding time before the playing point;

The second key frame of the two key frames is: key frames in the media file that are decoded later than the first key frame.

17. The apparatus of claim 14, wherein the obtaining unit is further configured to, when two key frames following the playback point in the media file with the target resolution are determined,

determining the offset and the capacity of a video frame between the two key frames and the offset and the capacity of an audio frame aligned with the video frame in the media file according to the media information identified from the media file with the target resolution;

Determining an offset and a capacity of a target interval according to the determined offset and capacity, wherein the target interval comprises the video frame and the audio frame;

And requesting the media server for the media data positioned in the target interval in the media file with the target resolution.

18. the apparatus according to claim 14, wherein the obtaining unit is further configured to fill data indicating the type and compatibility of the segmented media file into a file type container of the segmented media file;

Populating metadata representing a file level of the segmented media file into a metadata container of the segmented media file;

And correspondingly filling the extracted media data and the metadata describing the media data into a media data container and a metadata container at a segmentation level in a segmentation container of the segmented media file.

19. a media file resolution switching apparatus, comprising:

A memory for storing executable instructions;

a processor for implementing the media file resolution switching method of any of claims 1 to 9 by executing executable instructions stored in the memory.

20. A storage medium having stored thereon executable instructions for implementing the media file resolution switching method of any one of claims 1 to 9 when executed.

29页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:视频播放方法、终端及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类