Tech Support Posted December 16, 2019 Share Posted December 16, 2019 This post explains how to configure video_view block (the actual video player block) to render different data specific to TV series. In order to find this block please go to Website UI -> Pages -> View Video page -> video_view. Open for editing to see its template code and configuration parameters. NOTE: the code is valid for video_view block only and can't be put into other templates. How to render basic TV series / TV season info Rendering basic data is quite simple as all information is selected by default inside video_view block. TV series: ID: {{$data.dvd_group.dvd_group_id}} Title: {{$data.dvd_group.title}} URL: {{$data.dvd_group.view_page_url}} Cover 1: {{if $data.dvd_group.cover1}}{{$data.dvd_group.base_files_url}}/{{$data.dvd_group.cover1}}{{/if}} Cover 2: {{if $data.dvd_group.cover2}}{{$data.dvd_group.base_files_url}}/{{$data.dvd_group.cover2}}{{/if}} TV season: ID: {{$data.dvd.dvd_id}} Title: {{$data.dvd.title}} URL: {{$data.dvd.view_page_url}} Cover 1 front: {{if $data.dvd.cover1_front}}{{$data.dvd.base_files_url}}/{{$data.dvd.cover1_front}}{{/if}} Cover 1 back: {{if $data.dvd.cover1_back}}{{$data.dvd.base_files_url}}/{{$data.dvd.cover1_back}}{{/if}} Cover 2 front: {{if $data.dvd.cover2_front}}{{$data.dvd.base_files_url}}/{{$data.dvd.cover2_front}}{{/if}} Cover 2 back: {{if $data.dvd.cover2_back}}{{$data.dvd.base_files_url}}/{{$data.dvd.cover2_back}}{{/if}} How to configure player to automatically redirect to the next video inside a TV season Locate the following line in template code: kt_player('kt_player', '{{$config.project_url}}/player/kt_player.swf?v={{$config.project_version}}', '100%', '100%', flashvars); Change it to the following: var player_obj = kt_player('kt_player', '{{$config.project_url}}/player/kt_player.swf?v={{$config.project_version}}', '100%', '100%', flashvars); {{if $data.dvd.dvd_id>0}} {{strip}} {{query_kvs table="`$config.tables_prefix`videos" select="list" where_dvd_id=$data.dvd.dvd_id sort_by="dvd_sort_id asc" assign="videos"}} {{assign var="next_video_url" value=""}} {{assign var="next_video_title" value=""}} {{assign var="current_video_url" value=""}} {{foreach from=$videos item="item"}} {{if !$next_video_url && $current_video_url}}{{assign var="next_video_url" value=$item.view_page_url}}{{assign var="next_video_title" value=$item.title}}{{/if}} {{if $item.video_id==$data.video_id}}{{assign var="current_video_url" value=$item.view_page_url}}{{/if}} {{/foreach}} {{/strip}} {{if $next_video_url}} player_obj.listen('ktVideoFinished', function() { // use {{$next_video_title}} variable for title if you need window.location = '{{$next_video_url}}'; }); {{/if}} {{/if}} NOTE: inside ktVideoFinished callback you may want to add some timer ticking and GUI notification that user will be redirected to a new video page in 3...2...1... This is not covered by this post, use some JS code to render the needed GUI. How to display all series in a TV season List of series will be ordered based on their sorting ID. {{if $data.dvd.dvd_id>0}} {{query_kvs table="`$config.tables_prefix`videos" select="list" where_dvd_id=$data.dvd.dvd_id sort_by="dvd_sort_id asc" assign="videos"}} <ul> {{foreach from=$videos item="item"}} <li> ID: {{$item.video_id}} Title: {{$item.title}} URL: {{$item.view_page_url}} Duration: {{$item.duration}} Screenshot: {{$config.content_url_videos_screenshots}}/{{$item.video_id|get_dir_by_id}}/{{$item.video_id}}/320x180/{{$item.screen_main}}.jpg </li> {{/foreach}} </ul> {{/if}} How to display all seasons in a TV series List of seasons will be ordered based on their sorting ID. {{if $data.dvd_group.dvd_group_id>0}} {{query_kvs table="`$config.tables_prefix`dvds" select="list" where_dvd_group_id=$data.dvd_group.dvd_group_id sort_by="sort_id asc" assign="seasons"}} <ul> {{foreach from=$seasons item="item"}} <li> ID: {{$item.dvd_group_id}} Title: {{$item.title}} URL: {{$item.view_page_url}} Cover 1 front: {{if $item.cover1_front}}{{$config.content_url_dvds}}/{{$item.dvd_id}}/{{$item.cover1_front}}{{/if}} Cover 1 back: {{if $item.cover1_back}}{{$config.content_url_dvds}}/{{$item.dvd_id}}/{{$item.cover1_back}}{{/if}} Cover 2 front: {{if $item.cover2_front}}{{$config.content_url_dvds}}/{{$item.dvd_id}}/{{$item.cover2_front}}{{/if}} Cover 2 back: {{if $item.cover2_back}}{{$config.content_url_dvds}}/{{$item.dvd_id}}/{{$item.cover2_back}}{{/if}} </li> {{/foreach}} </ul> {{/if}} Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.